diff options
author | lloyd <[email protected]> | 2010-03-04 03:22:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-04 03:22:35 +0000 |
commit | 76f39cc9fe4b2a3354db22f8beaf0c3788578b79 (patch) | |
tree | c25ddaf29f22dc29786487d606d68c2344c46f22 /src/pubkey/dl_algo | |
parent | da09382f398dcf27a3ffdb82dd9f916ba96567ac (diff) |
Add a new constructor to each public key algorithm (only the public
keys so far, private keys not changed) that takes an
AlgorithmIdentifier and a MemoryRegion<byte>&. This performs the X.509
decoding. It is not possible anymore to create uninitialized PK
objects.
Diffstat (limited to 'src/pubkey/dl_algo')
-rw-r--r-- | src/pubkey/dl_algo/dl_algo.cpp | 10 | ||||
-rw-r--r-- | src/pubkey/dl_algo/dl_algo.h | 6 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/pubkey/dl_algo/dl_algo.cpp b/src/pubkey/dl_algo/dl_algo.cpp index f035f852f..bf7ab0a6a 100644 --- a/src/pubkey/dl_algo/dl_algo.cpp +++ b/src/pubkey/dl_algo/dl_algo.cpp @@ -23,6 +23,16 @@ MemoryVector<byte> DL_Scheme_PublicKey::x509_subject_public_key() const return DER_Encoder().encode(y).get_contents(); } +DL_Scheme_PublicKey::DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id, + const MemoryRegion<byte>& key_bits, + DL_Group::Format format) + { + DataSource_Memory source(alg_id.parameters); + group.BER_decode(source, format); + + BER_Decoder(key_bits).decode(y); + } + /* * Return the X.509 public key decoder */ diff --git a/src/pubkey/dl_algo/dl_algo.h b/src/pubkey/dl_algo/dl_algo.h index 9e5e46e2a..7492dc3bd 100644 --- a/src/pubkey/dl_algo/dl_algo.h +++ b/src/pubkey/dl_algo/dl_algo.h @@ -68,7 +68,13 @@ class BOTAN_DLL DL_Scheme_PublicKey : public virtual Public_Key * values in this instance. */ X509_Decoder* x509_decoder(); + + DL_Scheme_PublicKey(const AlgorithmIdentifier& alg_id, + const MemoryRegion<byte>& key_bits, + DL_Group::Format group_format); + protected: + DL_Scheme_PublicKey() {} BigInt y; DL_Group group; private: |