diff options
author | lloyd <[email protected]> | 2008-09-28 22:14:54 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 22:14:54 +0000 |
commit | 31204986023619c385d378e79a6511bb81ef7b78 (patch) | |
tree | ce272a6585dc070f750f6875b0450d53145b935d /src/asn1_ku.cpp | |
parent | 42c0fe76ab6d9625d0e51c68b8dd187322c991bd (diff) |
Move almost all of the ASN.1, BER, and DER codec related code into new
module asn1
Move hex and base64 codecs into new codecs directory. Also move zlib and
bzip2 to codecs from compress.
Diffstat (limited to 'src/asn1_ku.cpp')
-rw-r--r-- | src/asn1_ku.cpp | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/src/asn1_ku.cpp b/src/asn1_ku.cpp deleted file mode 100644 index 32c5944dd..000000000 --- a/src/asn1_ku.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************* -* KeyUsage Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#include <botan/asn1_obj.h> -#include <botan/der_enc.h> -#include <botan/ber_dec.h> - -namespace Botan { - -namespace BER { - -/************************************************* -* Decode a BER encoded KeyUsage * -*************************************************/ -void decode(BER_Decoder& source, Key_Constraints& key_usage) - { - BER_Object obj = source.get_next_object(); - - if(obj.type_tag != BIT_STRING || obj.class_tag != UNIVERSAL) - throw BER_Bad_Tag("Bad tag for usage constraint", - obj.type_tag, obj.class_tag); - if(obj.value.size() != 2 && obj.value.size() != 3) - throw BER_Decoding_Error("Bad size for BITSTRING in usage constraint"); - if(obj.value[0] >= 8) - throw BER_Decoding_Error("Invalid unused bits in usage constraint"); - - const byte mask = (0xFF << obj.value[0]); - obj.value[obj.value.size()-1] &= mask; - - u16bit usage = 0; - for(u32bit j = 1; j != obj.value.size(); ++j) - usage = (obj.value[j] << 8) | usage; - - key_usage = Key_Constraints(usage); - } - -} - -} |