aboutsummaryrefslogtreecommitdiffstats
path: root/src/x509_key.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-05-19 00:07:25 +0000
committerlloyd <[email protected]>2006-05-19 00:07:25 +0000
commitf090e030be53e574fecbe7cf50edfb5fdacb53e1 (patch)
tree0bff0c249a9dbcb674fcd2491ab17e3d123ef1f9 /src/x509_key.cpp
parenta0af7b26591f8fb79d1f06fe42548e1eb0c35e90 (diff)
Syntax changes to the BER and DER APIs to improve readability of code
that uses them. These changes are not backwards compatible, this commit updates all uses of the APIs within the library.
Diffstat (limited to 'src/x509_key.cpp')
-rw-r--r--src/x509_key.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/x509_key.cpp b/src/x509_key.cpp
index 118242b4e..08b440a3d 100644
--- a/src/x509_key.cpp
+++ b/src/x509_key.cpp
@@ -6,6 +6,8 @@
#include <botan/x509_key.h>
#include <botan/filters.h>
#include <botan/asn1_obj.h>
+#include <botan/der_enc.h>
+#include <botan/ber_dec.h>
#include <botan/pk_algs.h>
#include <botan/oids.h>
#include <botan/pem.h>
@@ -47,11 +49,12 @@ namespace {
void X509_extract_info(DataSource& source, AlgorithmIdentifier& alg_id,
MemoryVector<byte>& key)
{
- BER_Decoder decoder(source);
- BER_Decoder sequence = BER::get_subsequence(decoder);
- BER::decode(sequence, alg_id);
- sequence.decode(key, BIT_STRING);
- sequence.verify_end();
+ BER_Decoder(source)
+ .start_cons(SEQUENCE)
+ .decode(alg_id)
+ .decode(key, BIT_STRING)
+ .verify_end()
+ .end_cons();
}
}
@@ -63,12 +66,12 @@ void encode(const X509_PublicKey& key, Pipe& pipe, X509_Encoding encoding)
{
AlgorithmIdentifier alg_id(key.get_oid(), key.DER_encode_params());
- MemoryVector<byte> der =
+ MemoryVector<byte> der =
DER_Encoder()
- .start_sequence()
+ .start_cons(SEQUENCE)
.encode(alg_id)
.encode(key.DER_encode_pub(), BIT_STRING)
- .end_sequence()
+ .end_cons()
.get_contents();
if(encoding == PEM)