From 559e2860f0716dc5c40697a08a790d3b7c42ce8e Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 6 Sep 2006 19:51:17 +0000 Subject: Rename instances of X509_PublicKey and PKCS8_PrivateKey --- src/pk_algs.cpp | 4 ++-- src/pkcs10.cpp | 2 +- src/pkcs8.cpp | 20 ++++++++++---------- src/x509_ca.cpp | 8 ++++---- src/x509_key.cpp | 18 +++++++++--------- src/x509_obj.cpp | 2 +- src/x509cert.cpp | 2 +- src/x509self.cpp | 8 ++++---- src/x509stor.cpp | 4 ++-- 9 files changed, 34 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/pk_algs.cpp b/src/pk_algs.cpp index e042a84f4..43332d66a 100644 --- a/src/pk_algs.cpp +++ b/src/pk_algs.cpp @@ -16,7 +16,7 @@ namespace Botan { /************************************************* * Get an PK public key object * *************************************************/ -X509_PublicKey* get_public_key(const std::string& alg_name) +Public_Key* get_public_key(const std::string& alg_name) { if(alg_name == "RSA") return new RSA_PublicKey; else if(alg_name == "DSA") return new DSA_PublicKey; @@ -31,7 +31,7 @@ X509_PublicKey* get_public_key(const std::string& alg_name) /************************************************* * Get an PK private key object * *************************************************/ -PKCS8_PrivateKey* get_private_key(const std::string& alg_name) +Private_Key* get_private_key(const std::string& alg_name) { if(alg_name == "RSA") return new RSA_PrivateKey; else if(alg_name == "DSA") return new DSA_PrivateKey; diff --git a/src/pkcs10.cpp b/src/pkcs10.cpp index 57d88d4af..6803a7165 100644 --- a/src/pkcs10.cpp +++ b/src/pkcs10.cpp @@ -144,7 +144,7 @@ MemoryVector PKCS10_Request::raw_public_key() const /************************************************* * Return the public key of the requestor * *************************************************/ -X509_PublicKey* PKCS10_Request::subject_public_key() const +Public_Key* PKCS10_Request::subject_public_key() const { DataSource_Memory source(info.get1("X509.Certificate.public_key")); return X509::load_key(source); diff --git a/src/pkcs8.cpp b/src/pkcs8.cpp index c4fc97031..ed4f01ee1 100644 --- a/src/pkcs8.cpp +++ b/src/pkcs8.cpp @@ -141,7 +141,7 @@ SecureVector PKCS8_decode(DataSource& source, const User_Interface& ui, /************************************************* * DER or PEM encode a PKCS #8 private key * *************************************************/ -void encode(const PKCS8_PrivateKey& key, Pipe& pipe, X509_Encoding encoding) +void encode(const Private_Key& key, Pipe& pipe, X509_Encoding encoding) { std::auto_ptr encoder(key.pkcs8_encoder()); if(!encoder.get()) @@ -167,7 +167,7 @@ void encode(const PKCS8_PrivateKey& key, Pipe& pipe, X509_Encoding encoding) /************************************************* * Encode and encrypt a PKCS #8 private key * *************************************************/ -void encrypt_key(const PKCS8_PrivateKey& key, Pipe& pipe, +void encrypt_key(const Private_Key& key, Pipe& pipe, const std::string& pass, const std::string& pbe_algo, X509_Encoding encoding) { @@ -201,7 +201,7 @@ void encrypt_key(const PKCS8_PrivateKey& key, Pipe& pipe, /************************************************* * PEM encode a PKCS #8 private key * *************************************************/ -std::string PEM_encode(const PKCS8_PrivateKey& key) +std::string PEM_encode(const Private_Key& key) { Pipe pem; pem.start_msg(); @@ -213,7 +213,7 @@ std::string PEM_encode(const PKCS8_PrivateKey& key) /************************************************* * Encrypt and PEM encode a PKCS #8 private key * *************************************************/ -std::string PEM_encode(const PKCS8_PrivateKey& key, const std::string& pass, +std::string PEM_encode(const Private_Key& key, const std::string& pass, const std::string& pbe_algo) { if(pass == "") @@ -229,7 +229,7 @@ std::string PEM_encode(const PKCS8_PrivateKey& key, const std::string& pass, /************************************************* * Extract a private key and return it * *************************************************/ -PKCS8_PrivateKey* load_key(DataSource& source, const User_Interface& ui) +Private_Key* load_key(DataSource& source, const User_Interface& ui) { AlgorithmIdentifier alg_id; SecureVector pkcs8_key = PKCS8_decode(source, ui, alg_id); @@ -239,7 +239,7 @@ PKCS8_PrivateKey* load_key(DataSource& source, const User_Interface& ui) throw PKCS8_Exception("Unknown algorithm OID: " + alg_id.oid.as_string()); - std::auto_ptr key(get_private_key(alg_name)); + std::auto_ptr key(get_private_key(alg_name)); if(!key.get()) throw PKCS8_Exception("Unknown PK algorithm/OID: " + alg_name + ", " + @@ -258,7 +258,7 @@ PKCS8_PrivateKey* load_key(DataSource& source, const User_Interface& ui) /************************************************* * Extract a private key and return it * *************************************************/ -PKCS8_PrivateKey* load_key(const std::string& fsname, const User_Interface& ui) +Private_Key* load_key(const std::string& fsname, const User_Interface& ui) { DataSource_Stream source(fsname, true); return PKCS8::load_key(source, ui); @@ -267,7 +267,7 @@ PKCS8_PrivateKey* load_key(const std::string& fsname, const User_Interface& ui) /************************************************* * Extract a private key and return it * *************************************************/ -PKCS8_PrivateKey* load_key(DataSource& source, const std::string& pass) +Private_Key* load_key(DataSource& source, const std::string& pass) { return PKCS8::load_key(source, User_Interface(pass)); } @@ -275,7 +275,7 @@ PKCS8_PrivateKey* load_key(DataSource& source, const std::string& pass) /************************************************* * Extract a private key and return it * *************************************************/ -PKCS8_PrivateKey* load_key(const std::string& fsname, const std::string& pass) +Private_Key* load_key(const std::string& fsname, const std::string& pass) { return PKCS8::load_key(fsname, User_Interface(pass)); } @@ -283,7 +283,7 @@ PKCS8_PrivateKey* load_key(const std::string& fsname, const std::string& pass) /************************************************* * Make a copy of this private key * *************************************************/ -PKCS8_PrivateKey* copy_key(const PKCS8_PrivateKey& key) +Private_Key* copy_key(const Private_Key& key) { Pipe bits; diff --git a/src/x509_ca.cpp b/src/x509_ca.cpp index d074afbe2..baa2c095c 100644 --- a/src/x509_ca.cpp +++ b/src/x509_ca.cpp @@ -24,9 +24,9 @@ namespace Botan { * Load the certificate and private key * *************************************************/ X509_CA::X509_CA(const X509_Certificate& c, - const PKCS8_PrivateKey& key) : cert(c) + const Private_Key& key) : cert(c) { - const PKCS8_PrivateKey* key_pointer = &key; + const Private_Key* key_pointer = &key; if(!dynamic_cast(key_pointer)) throw Invalid_Argument("X509_CA: " + key.algo_name() + " cannot sign"); @@ -50,7 +50,7 @@ X509_Certificate X509_CA::sign_request(const PKCS10_Request& req, constraints = Key_Constraints(KEY_CERT_SIGN | CRL_SIGN); else { - std::auto_ptr key(req.subject_public_key()); + std::auto_ptr key(req.subject_public_key()); constraints = X509::find_constraints(*key, req.constraints()); } @@ -243,7 +243,7 @@ X509_CA::~X509_CA() /************************************************* * Choose a signing format for the key * *************************************************/ -PK_Signer* choose_sig_format(const PKCS8_PrivateKey& key, +PK_Signer* choose_sig_format(const Private_Key& key, AlgorithmIdentifier& sig_algo) { std::string padding; diff --git a/src/x509_key.cpp b/src/x509_key.cpp index 332297e78..15b83ced7 100644 --- a/src/x509_key.cpp +++ b/src/x509_key.cpp @@ -20,7 +20,7 @@ namespace X509 { /************************************************* * DER or PEM encode a X.509 public key * *************************************************/ -void encode(const X509_PublicKey& key, Pipe& pipe, X509_Encoding encoding) +void encode(const Public_Key& key, Pipe& pipe, X509_Encoding encoding) { std::auto_ptr encoder(key.x509_encoder()); if(!encoder.get()) @@ -43,7 +43,7 @@ void encode(const X509_PublicKey& key, Pipe& pipe, X509_Encoding encoding) /************************************************* * PEM encode a X.509 public key * *************************************************/ -std::string PEM_encode(const X509_PublicKey& key) +std::string PEM_encode(const Public_Key& key) { Pipe pem; pem.start_msg(); @@ -55,7 +55,7 @@ std::string PEM_encode(const X509_PublicKey& key) /************************************************* * Extract a public key and return it * *************************************************/ -X509_PublicKey* load_key(DataSource& source) +Public_Key* load_key(DataSource& source) { try { AlgorithmIdentifier alg_id; @@ -92,7 +92,7 @@ X509_PublicKey* load_key(DataSource& source) throw Decoding_Error("Unknown algorithm OID: " + alg_id.oid.as_string()); - std::auto_ptr key_obj(get_public_key(alg_name)); + std::auto_ptr key_obj(get_public_key(alg_name)); if(!key_obj.get()) throw Decoding_Error("Unknown PK algorithm/OID: " + alg_name + ", " + alg_id.oid.as_string()); @@ -115,7 +115,7 @@ X509_PublicKey* load_key(DataSource& source) /************************************************* * Extract a public key and return it * *************************************************/ -X509_PublicKey* load_key(const std::string& fsname) +Public_Key* load_key(const std::string& fsname) { DataSource_Stream source(fsname, true); return X509::load_key(source); @@ -124,7 +124,7 @@ X509_PublicKey* load_key(const std::string& fsname) /************************************************* * Extract a public key and return it * *************************************************/ -X509_PublicKey* load_key(const MemoryRegion& mem) +Public_Key* load_key(const MemoryRegion& mem) { DataSource_Memory source(mem); return X509::load_key(source); @@ -133,7 +133,7 @@ X509_PublicKey* load_key(const MemoryRegion& mem) /************************************************* * Make a copy of this public key * *************************************************/ -X509_PublicKey* copy_key(const X509_PublicKey& key) +Public_Key* copy_key(const Public_Key& key) { Pipe bits; bits.start_msg(); @@ -146,10 +146,10 @@ X509_PublicKey* copy_key(const X509_PublicKey& key) /************************************************* * Find the allowable key constraints * *************************************************/ -Key_Constraints find_constraints(const X509_PublicKey& pub_key, +Key_Constraints find_constraints(const Public_Key& pub_key, Key_Constraints limits) { - const X509_PublicKey* key = &pub_key; + const Public_Key* key = &pub_key; u32bit constraints = 0; if(dynamic_cast(key)) diff --git a/src/x509_obj.cpp b/src/x509_obj.cpp index 44cbe35d8..072505957 100644 --- a/src/x509_obj.cpp +++ b/src/x509_obj.cpp @@ -153,7 +153,7 @@ AlgorithmIdentifier X509_Object::signature_algorithm() const /************************************************* * Check the signature on an object * *************************************************/ -bool X509_Object::check_signature(X509_PublicKey& pub_key) const +bool X509_Object::check_signature(Public_Key& pub_key) const { try { std::vector sig_info = diff --git a/src/x509cert.cpp b/src/x509cert.cpp index dd919e509..4a1152cf5 100644 --- a/src/x509cert.cpp +++ b/src/x509cert.cpp @@ -186,7 +186,7 @@ X509_Certificate::issuer_info(const std::string& what) const /************************************************* * Return the public key in this certificate * *************************************************/ -X509_PublicKey* X509_Certificate::subject_public_key() const +Public_Key* X509_Certificate::subject_public_key() const { DataSource_Memory source(subject.get1("X509.Certificate.public_key")); return X509::load_key(source); diff --git a/src/x509self.cpp b/src/x509self.cpp index 5707c1a58..9820c0270 100644 --- a/src/x509self.cpp +++ b/src/x509self.cpp @@ -21,9 +21,9 @@ namespace { * Shared setup for self-signed items * *************************************************/ MemoryVector shared_setup(const X509_Cert_Options& opts, - const PKCS8_PrivateKey& key) + const Private_Key& key) { - const PKCS8_PrivateKey* key_pointer = &key; + const Private_Key* key_pointer = &key; if(!dynamic_cast(key_pointer)) throw Invalid_Argument("Key type " + key.algo_name() + " cannot sign"); @@ -63,7 +63,7 @@ namespace X509 { * Create a new self-signed X.509 certificate * *************************************************/ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts, - const PKCS8_PrivateKey& key) + const Private_Key& key) { AlgorithmIdentifier sig_algo; X509_DN subject_dn; @@ -100,7 +100,7 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts, * Create a PKCS #10 certificate request * *************************************************/ PKCS10_Request create_cert_req(const X509_Cert_Options& opts, - const PKCS8_PrivateKey& key) + const Private_Key& key) { AlgorithmIdentifier sig_algo; X509_DN subject_dn; diff --git a/src/x509stor.cpp b/src/x509stor.cpp index 350cf965e..797f53e08 100644 --- a/src/x509stor.cpp +++ b/src/x509stor.cpp @@ -354,9 +354,9 @@ X509_Code X509_Store::check_sig(const Cert_Info& cert_info, /************************************************* * Check a CA's signature * *************************************************/ -X509_Code X509_Store::check_sig(const X509_Object& object, X509_PublicKey* key) +X509_Code X509_Store::check_sig(const X509_Object& object, Public_Key* key) { - std::auto_ptr pub_key(key); + std::auto_ptr pub_key(key); std::auto_ptr verifier; try { -- cgit v1.2.3