diff options
author | lloyd <[email protected]> | 2010-03-04 05:20:59 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-04 05:20:59 +0000 |
commit | 2548328cc11d76036e8fc714172b130f2a8c3ebc (patch) | |
tree | a34b62ed0e5ca90b69f0a82ba8c00e41dc91b912 /src/pubkey/pk_keys.h | |
parent | d490c5bed4331a4336556e08873fe03a792ad127 (diff) |
Quite the hack, here.
GOST 34.10 public keys use a funky encoding. There is no standard for
PKCS #8 format private keys, so the obvious choice is to act exactly
the same as ECDSA/ECDH (following the rule of thumb that if you're
going to make up a random non-standard thing, at least try to copy
something that's standard for something else). However the public key
encoding uses a weird scheme for encoding the OID in the algorithm
identifier, which we don't want to use for the PKCS #8 encoding.
Add a new function to Private_Key, pkcs8_algorithm_identifier, which
by default just calls algorithm_identifier(). However
GOST_3410_PrivateKey overrides it, and calls
EC_PublicKey::algorithm_identifier(), basically skipping over the
virtual function hierarchy, so it doesn't pick up the funky format
from the public key's version of algorithm_identifier().
Diffstat (limited to 'src/pubkey/pk_keys.h')
-rw-r--r-- | src/pubkey/pk_keys.h | 7 |
1 files changed, 7 insertions, 0 deletions
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; |