aboutsummaryrefslogtreecommitdiffstats
path: root/src/pbes1.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/pbes1.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/pbes1.cpp')
-rw-r--r--src/pbes1.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/pbes1.cpp b/src/pbes1.cpp
index d99e9a1fd..da97ee2da 100644
--- a/src/pbes1.cpp
+++ b/src/pbes1.cpp
@@ -94,14 +94,12 @@ void PBE_PKCS5v15::new_params()
*************************************************/
MemoryVector<byte> PBE_PKCS5v15::encode_params() const
{
- DER_Encoder der;
-
- der.start_sequence()
- .encode(salt, OCTET_STRING)
- .encode(iterations)
- .end_sequence();
-
- return der.get_contents();
+ return DER_Encoder()
+ .start_cons(SEQUENCE)
+ .encode(salt, OCTET_STRING)
+ .encode(iterations)
+ .end_cons()
+ .get_contents();
}
/*************************************************
@@ -109,11 +107,12 @@ MemoryVector<byte> PBE_PKCS5v15::encode_params() const
*************************************************/
void PBE_PKCS5v15::decode_params(DataSource& source)
{
- BER_Decoder decoder(source);
- BER_Decoder sequence = BER::get_subsequence(decoder);
- sequence.decode(salt, OCTET_STRING);
- sequence.decode(iterations);
- sequence.verify_end();
+ BER_Decoder(source)
+ .start_cons(SEQUENCE)
+ .decode(salt, OCTET_STRING)
+ .decode(iterations)
+ .verify_end()
+ .end_cons();
if(salt.size() != 8)
throw Decoding_Error("PBES1: Encoded salt is not 8 octets");