diff options
Diffstat (limited to 'src/pubkey')
-rw-r--r-- | src/pubkey/gost_3410/gost_3410.h | 3 | ||||
-rw-r--r-- | src/pubkey/pk_keys.h | 7 | ||||
-rw-r--r-- | src/pubkey/pkcs8.cpp | 2 |
3 files changed, 11 insertions, 1 deletions
diff --git a/src/pubkey/gost_3410/gost_3410.h b/src/pubkey/gost_3410/gost_3410.h index 696daf0a7..669ed130f 100644 --- a/src/pubkey/gost_3410/gost_3410.h +++ b/src/pubkey/gost_3410/gost_3410.h @@ -103,6 +103,9 @@ class BOTAN_DLL GOST_3410_PrivateKey : public GOST_3410_PublicKey, GOST_3410_PrivateKey(const EC_Domain_Params& domain, const BigInt& x) : EC_PrivateKey(domain, x) {} + AlgorithmIdentifier pkcs8_algorithm_identifier() const + { return EC_PublicKey::algorithm_identifier(); } + /** * Sign a message with this key. * @param message the byte array representing the message to be signed diff --git a/src/pubkey/pk_keys.h b/src/pubkey/pk_keys.h index 4e0f58b38..8015c1076 100644 --- a/src/pubkey/pk_keys.h +++ b/src/pubkey/pk_keys.h @@ -87,6 +87,13 @@ class BOTAN_DLL Private_Key : public virtual Public_Key */ virtual MemoryVector<byte> pkcs8_private_key() const = 0; + /** + * @return PKCS #8 AlgorithmIdentifier for this key + * Might be different from the X.509 identifier, but normally is not + */ + virtual AlgorithmIdentifier pkcs8_algorithm_identifier() const + { return algorithm_identifier(); } + protected: void load_check(RandomNumberGenerator&) const; void gen_check(RandomNumberGenerator&) const; diff --git a/src/pubkey/pkcs8.cpp b/src/pubkey/pkcs8.cpp index c89431fca..400fdbb48 100644 --- a/src/pubkey/pkcs8.cpp +++ b/src/pubkey/pkcs8.cpp @@ -144,7 +144,7 @@ void encode(const Private_Key& key, Pipe& pipe, X509_Encoding encoding) DER_Encoder() .start_cons(SEQUENCE) .encode(PKCS8_VERSION) - .encode(key.algorithm_identifier()) + .encode(key.pkcs8_algorithm_identifier()) .encode(key.pkcs8_private_key(), OCTET_STRING) .end_cons() .get_contents(); |