diff options
author | lloyd <[email protected]> | 2011-05-17 20:44:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-05-17 20:44:00 +0000 |
commit | dedc258d16e714f8694c9a812277fb56e3874fe1 (patch) | |
tree | 8a23ae6d6336ffd1fe8daf7d208c2608d212ffc5 /src | |
parent | b0560e9a8fee0391146e3b4ad25434950aba80e2 (diff) |
Fix the very basic operations for encoding and decoding a
certificate policies extension, though it's really not supported
at all.
Remove test code from secmem.h
Fix building the examples
Diffstat (limited to 'src')
-rw-r--r-- | src/alloc/secmem.h | 7 | ||||
-rw-r--r-- | src/cert/x509cert/x509_ext.cpp | 15 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/alloc/secmem.h b/src/alloc/secmem.h index b06be0d55..80e8e59aa 100644 --- a/src/alloc/secmem.h +++ b/src/alloc/secmem.h @@ -34,7 +34,6 @@ class MemoryRegion */ bool empty() const { return (used == 0); } -#if 1 /** * Get a pointer to the first element in the buffer. * @return pointer to the first element in the buffer @@ -46,12 +45,6 @@ class MemoryRegion * @return constant pointer to the first element in the buffer */ operator const T* () const { return buf; } -#else - - T& operator[](size_t n) { return buf[n]; } - const T& operator[](size_t n) const { return buf[n]; } - -#endif /** * Get a pointer to the first element in the buffer. diff --git a/src/cert/x509cert/x509_ext.cpp b/src/cert/x509cert/x509_ext.cpp index 462b29669..6e0befaf3 100644 --- a/src/cert/x509cert/x509_ext.cpp +++ b/src/cert/x509cert/x509_ext.cpp @@ -443,6 +443,9 @@ class Policy_Information : public ASN1_Object public: OID oid; + Policy_Information() {} + Policy_Information(const OID& oid) : oid(oid) {} + void encode_into(DER_Encoder& codec) const { codec.start_cons(SEQUENCE) @@ -466,18 +469,16 @@ class Policy_Information : public ASN1_Object */ MemoryVector<byte> Certificate_Policies::encode_inner() const { - // FIXME -#if 1 - throw Internal_Error("Certificate_Policies::encode_inner: Bugged"); -#else std::vector<Policy_Information> policies; + for(size_t i = 0; i != oids.size(); ++i) + policies.push_back(oids[i]); + return DER_Encoder() .start_cons(SEQUENCE) .encode_list(policies) .end_cons() .get_contents(); -#endif } /* @@ -491,6 +492,10 @@ void Certificate_Policies::decode_inner(const MemoryRegion<byte>& in) .start_cons(SEQUENCE) .decode_list(policies) .end_cons(); + + oids.clear(); + for(size_t i = 0; i != policies.size(); ++i) + oids.push_back(policies[i].oid); } /* |