aboutsummaryrefslogtreecommitdiffstats
path: root/src/pubkey
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-04 05:02:54 +0000
committerlloyd <[email protected]>2010-03-04 05:02:54 +0000
commit737dfc9a44103cb3be4a9821f96a30e08d009ac6 (patch)
tree52470a84ff38c97ff2b77ddad2ec4058a5a0d4f3 /src/pubkey
parent2d3d341854cad6433cf88c2e65172a98dac2404d (diff)
Fix GOST 34.10 pubkey encoding
Diffstat (limited to 'src/pubkey')
-rw-r--r--src/pubkey/gost_3410/gost_3410.cpp14
-rw-r--r--src/pubkey/gost_3410/gost_3410.h2
2 files changed, 13 insertions, 3 deletions
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 <botan/gost_3410.h>
-#include <botan/numthry.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
-#include <botan/secmem.h>
-#include <botan/point_gfp.h>
namespace Botan {
@@ -30,6 +27,17 @@ MemoryVector<byte> 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<byte> 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<byte>& 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<byte> x509_subject_public_key() const;
/**