8 #include <botan/x509_obj.h>     9 #include <botan/x509_key.h>    10 #include <botan/pubkey.h>    11 #include <botan/oids.h>    12 #include <botan/der_enc.h>    13 #include <botan/ber_dec.h>    14 #include <botan/parsing.h>    15 #include <botan/pem.h>    41 void X509_Object::init(
DataSource& in, 
const std::string& labels)
    43    PEM_labels_allowed = 
split_on(labels, 
'/');
    44    if(PEM_labels_allowed.size() < 1)
    47    PEM_label_pref = PEM_labels_allowed[0];
    48    std::sort(PEM_labels_allowed.begin(), PEM_labels_allowed.end());
    55          std::string got_label;
    58          if(!std::binary_search(PEM_labels_allowed.begin(),
    59                                 PEM_labels_allowed.end(), got_label))
    66       throw Decoding_Error(PEM_label_pref + 
" decoding failed: " + e.what());
    73 void X509_Object::decode_info(
DataSource& source)
   150    std::vector<std::string> sig_info =
   153    if(sig_info.size() != 2)
   157    std::vector<std::string> pad_and_hash =
   160    if(pad_and_hash.size() != 2)
   163    return pad_and_hash[1];
   171    std::auto_ptr<Public_Key> key(pub_key);
   181       std::vector<std::string> sig_info =
   184       if(sig_info.size() != 2 || sig_info[0] != pub_key.
algo_name())
   187       std::string padding = sig_info[1];
 std::vector< std::string > parse_algorithm_name(const std::string &namex)
SecureVector< byte > get_contents()
MemoryVector< byte > tbs_bits
MemoryVector< byte > tbs_data() const
DER_Encoder & raw_bytes(const byte val[], size_t len)
void write(const byte in[], size_t length)
BER_Decoder & decode(bool &)
std::string as_string() const
std::vector< std::string > split_on(const std::string &str, char delim)
virtual std::string algo_name() const =0
std::invalid_argument Invalid_Argument
bool maybe_BER(DataSource &source)
BER_Decoder start_cons(ASN1_Tag, ASN1_Tag=UNIVERSAL)
bool check_signature(class Public_Key &key) const
MemoryVector< byte > BER_encode() const
SecureVector< byte > decode(DataSource &source, std::string &label)
DER_Encoder & encode(bool b)
AlgorithmIdentifier signature_algorithm() const
SecureVector< byte > sign_message(const byte in[], size_t length, RandomNumberGenerator &rng)
AlgorithmIdentifier sig_algo
std::string lookup(const OID &oid)
bool verify_message(const byte msg[], size_t msg_length, const byte sig[], size_t sig_length)
MemoryVector< byte > signature() const
bool matches(DataSource &source, const std::string &extra, size_t search_range)
static MemoryVector< byte > make_signed(class PK_Signer *signer, RandomNumberGenerator &rng, const AlgorithmIdentifier &alg_id, const MemoryRegion< byte > &tbs)
SecureVector< byte > put_in_sequence(const MemoryRegion< byte > &contents)
std::string hash_used_for_signature() const
std::string encode(const byte der[], size_t length, const std::string &label, size_t width)
BER_Decoder & raw_bytes(MemoryRegion< byte > &)
BER_Decoder & verify_end()
void encode(Pipe &out, X509_Encoding encoding=PEM) const
DER_Encoder & start_cons(ASN1_Tag type_tag, ASN1_Tag class_tag=UNIVERSAL)
std::string PEM_encode() const
virtual size_t message_parts() const