From 737dfc9a44103cb3be4a9821f96a30e08d009ac6 Mon Sep 17 00:00:00 2001 From: lloyd Date: Thu, 4 Mar 2010 05:02:54 +0000 Subject: Fix GOST 34.10 pubkey encoding --- src/pubkey/gost_3410/gost_3410.cpp | 14 +++++++++++--- src/pubkey/gost_3410/gost_3410.h | 2 ++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/pubkey/gost_3410') diff --git a/src/pubkey/gost_3410/gost_3410.cpp b/src/pubkey/gost_3410/gost_3410.cpp index 47438653d..46afad44e 100644 --- a/src/pubkey/gost_3410/gost_3410.cpp +++ b/src/pubkey/gost_3410/gost_3410.cpp @@ -8,11 +8,8 @@ */ #include -#include #include #include -#include -#include namespace Botan { @@ -30,6 +27,17 @@ MemoryVector GOST_3410_PublicKey::x509_subject_public_key() const return DER_Encoder().encode(bits, OCTET_STRING).get_contents(); } +AlgorithmIdentifier GOST_3410_PublicKey::algorithm_identifier() const + { + MemoryVector params = + DER_Encoder().start_cons(SEQUENCE) + .encode(OID(domain().get_oid())) + .end_cons() + .get_contents(); + + return AlgorithmIdentifier(get_oid(), params); + } + GOST_3410_PublicKey::GOST_3410_PublicKey(const AlgorithmIdentifier& alg_id, const MemoryRegion& key_bits) { diff --git a/src/pubkey/gost_3410/gost_3410.h b/src/pubkey/gost_3410/gost_3410.h index eb80943b1..696daf0a7 100644 --- a/src/pubkey/gost_3410/gost_3410.h +++ b/src/pubkey/gost_3410/gost_3410.h @@ -43,6 +43,8 @@ class BOTAN_DLL GOST_3410_PublicKey : public virtual EC_PublicKey, */ std::string algo_name() const { return "GOST-34.10"; } + AlgorithmIdentifier algorithm_identifier() const; + MemoryVector x509_subject_public_key() const; /** -- cgit v1.2.3