diff options
author | lloyd <[email protected]> | 2006-05-19 00:07:25 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-05-19 00:07:25 +0000 |
commit | f090e030be53e574fecbe7cf50edfb5fdacb53e1 (patch) | |
tree | 0bff0c249a9dbcb674fcd2491ab17e3d123ef1f9 /src/asn1_att.cpp | |
parent | a0af7b26591f8fb79d1f06fe42548e1eb0c35e90 (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/asn1_att.cpp')
-rw-r--r-- | src/asn1_att.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/asn1_att.cpp b/src/asn1_att.cpp index 58ed761b4..8216054b3 100644 --- a/src/asn1_att.cpp +++ b/src/asn1_att.cpp @@ -4,6 +4,8 @@ *************************************************/ #include <botan/asn1_obj.h> +#include <botan/der_enc.h> +#include <botan/ber_dec.h> #include <botan/oids.h> namespace Botan { @@ -30,33 +32,27 @@ Attribute::Attribute(const std::string& attr_oid, /************************************************* * DER encode a Attribute * *************************************************/ -void Attribute::encode_into(DER_Encoder& der) const +void Attribute::encode_into(DER_Encoder& codec) const { - der.start_sequence() + codec.start_cons(SEQUENCE) .encode(oid) - .start_set() - .add_raw_octets(parameters) - .end_set() - .end_sequence(); + .start_cons(SET) + .raw_bytes(parameters) + .end_cons() + .end_cons(); } -namespace BER { - /************************************************* * Decode a BER encoded Attribute * *************************************************/ -void decode(BER_Decoder& source, Attribute& attr) +void Attribute::decode_from(BER_Decoder& codec) { - BER_Decoder decoder = BER::get_subsequence(source); - BER::decode(decoder, attr.oid); - - BER_Decoder attributes = BER::get_subset(decoder); - attr.parameters = attributes.get_remaining(); - attributes.verify_end(); - - decoder.verify_end(); + codec.start_cons(SEQUENCE) + .decode(oid) + .start_cons(SET) + .raw_bytes(parameters) + .end_cons() + .end_cons(); } } - -} |