The unified diff between revisions [82d99605..] and [b3f30c54..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/asn1_alg.cpp'
#
#
# rename "src/asn1_alg.cpp"
# to "src/alg_id.cpp"
#
# patch "src/alg_id.cpp"
# from [2a7e65bc853cd8a40b6c3321b541198abe2bd4e8]
# to [a4419677bfb3b0589e9a150d8bee91170721f06d]
#
============================================================
--- src/asn1_alg.cpp 2a7e65bc853cd8a40b6c3321b541198abe2bd4e8
+++ src/alg_id.cpp a4419677bfb3b0589e9a150d8bee91170721f06d
@@ -1,9 +1,9 @@
/*************************************************
* Algorithm Identifier Source File *
-* (C) 1999-2006 The Botan Project *
+* (C) 1999-2007 Jack Lloyd *
*************************************************/
-#include <botan/asn1_obj.h>
+#include <botan/alg_id.h>
#include <botan/der_enc.h>
#include <botan/ber_dec.h>
#include <botan/oids.h>
@@ -14,17 +14,49 @@ AlgorithmIdentifier::AlgorithmIdentifier
* Create an AlgorithmIdentifier *
*************************************************/
AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id,
- const MemoryRegion<byte>& param) :
- oid(alg_id), parameters(param) { }
+ const MemoryRegion<byte>& param)
+ {
+ oid = alg_id;
+ parameters = param;
+ }
/*************************************************
* Create an AlgorithmIdentifier *
*************************************************/
AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id,
- const MemoryRegion<byte>& param) :
- oid(OIDS::lookup(alg_id)), parameters(param) { }
+ const MemoryRegion<byte>& param)
+ {
+ oid = OIDS::lookup(alg_id);
+ parameters = param;
+ }
/*************************************************
+* Create an AlgorithmIdentifier *
+*************************************************/
+AlgorithmIdentifier::AlgorithmIdentifier(const OID& alg_id,
+ Encoding_Option option)
+ {
+ const byte DER_NULL[] = { 0x05, 0x00 };
+
+ oid = alg_id;
+ if(option == USE_NULL_PARAM)
+ parameters.append(DER_NULL, sizeof(DER_NULL));
+ }
+
+/*************************************************
+* Create an AlgorithmIdentifier *
+*************************************************/
+AlgorithmIdentifier::AlgorithmIdentifier(const std::string& alg_id,
+ Encoding_Option option)
+ {
+ const byte DER_NULL[] = { 0x05, 0x00 };
+
+ oid = OIDS::lookup(alg_id);
+ if(option == USE_NULL_PARAM)
+ parameters.append(DER_NULL, sizeof(DER_NULL));
+ }
+
+/*************************************************
* Compare two AlgorithmIdentifiers *
*************************************************/
bool operator==(const AlgorithmIdentifier& a1, const AlgorithmIdentifier& a2)