diff options
author | 2019-01-02 09:59:48 -0800 | |
---|---|---|
committer | 2019-03-29 09:59:04 -0700 | |
commit | 7626b75b3c71173ba62c2f92d22bab8f4291e44a (patch) | |
tree | 7308a2628a014fef0f245ef4f00408cf92d15e60 /SoftHSMv2/src/lib/crypto/BotanUtil.cpp | |
parent | f2ff7a136a152b36b3aa4d0d574796e6edbef24a (diff) |
Update SoftHSM v2.0 to the latest version
Change-Id: Ib3ec2c297f897c82776a66fe2ad55b18984c0337
Issue-ID: AAF-687
Signed-off-by: Pramod Raghavendra Jayathirth <pramod.raghavendra.jayathirth@intel.com>
Diffstat (limited to 'SoftHSMv2/src/lib/crypto/BotanUtil.cpp')
-rw-r--r-- | SoftHSMv2/src/lib/crypto/BotanUtil.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/SoftHSMv2/src/lib/crypto/BotanUtil.cpp b/SoftHSMv2/src/lib/crypto/BotanUtil.cpp index e5da460..c623fed 100644 --- a/SoftHSMv2/src/lib/crypto/BotanUtil.cpp +++ b/SoftHSMv2/src/lib/crypto/BotanUtil.cpp @@ -144,3 +144,22 @@ Botan::PointGFp BotanUtil::byteString2ECPoint(const ByteString& byteString, cons return Botan::OS2ECP(&repr[0], repr.size(), ecGroup.get_curve()); } #endif + +#ifdef WITH_EDDSA +// Convert a Botan OID to a ByteString +ByteString BotanUtil::oid2ByteString(const Botan::OID& oid) +{ + const Botan::secure_vector<Botan::byte>& der = Botan::DER_Encoder().encode(oid).get_contents(); + return ByteString(&der[0], der.size()); +} + +// Convert a ByteString to a Botan OID +Botan::OID BotanUtil::byteString2Oid(const ByteString& byteString) +{ + Botan::OID oid; + Botan::BER_Decoder(byteString.const_byte_str(), byteString.size()) + .decode(oid) + .verify_end(); + return oid; +} +#endif |