xmltooling
3.0.3
|
A helper class for working with keys, certificates, etc. More...
#include <xmltooling/security/SecurityHelper.h>
Static Public Member Functions | |
static const char * | guessEncodingFormat (const char *pathname) |
Access a file to try and guess the encoding format used. More... | |
static XSECCryptoKey * | loadKeyFromFile (const char *pathname, const char *format=0, const char *password=0) |
Loads a private key from a local file. More... | |
static std::vector < XSECCryptoX509 * > ::size_type | loadCertificatesFromFile (std::vector< XSECCryptoX509 * > &certs, const char *pathname, const char *format=0, const char *password=0) |
Loads certificate(s) from a local file. More... | |
static std::vector < XSECCryptoX509CRL * > ::size_type | loadCRLsFromFile (std::vector< XSECCryptoX509CRL * > &crls, const char *pathname, const char *format=0) |
Loads CRL(s) from a local file. More... | |
static XSECCryptoKey * | loadKeyFromURL (SOAPTransport &transport, const char *backing, const char *format=0, const char *password=0) |
Loads a private key from a URL. More... | |
static std::vector < XSECCryptoX509 * > ::size_type | loadCertificatesFromURL (std::vector< XSECCryptoX509 * > &certs, SOAPTransport &transport, const char *backing, const char *format=0, const char *password=0) |
Loads certificate(s) from a URL. More... | |
static std::vector < XSECCryptoX509CRL * > ::size_type | loadCRLsFromURL (std::vector< XSECCryptoX509CRL * > &crls, SOAPTransport &transport, const char *backing, const char *format=0) |
Loads CRL(s) from a URL. More... | |
static bool | matches (const XSECCryptoKey &key1, const XSECCryptoKey &key2) |
Compares two keys for equality. More... | |
static std::string | doHash (const char *hashAlg, const char *buf, unsigned long buflen, bool toHex=true) |
Performs a hash operation over the supplied data. More... | |
static std::string | getDEREncoding (const Credential &cred, const char *hash=0, bool nowrap=true) |
Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format. More... | |
static std::string | getDEREncoding (const XSECCryptoKey &key, const char *hash=0, bool nowrap=true) |
Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format. More... | |
static std::string | getDEREncoding (const XSECCryptoX509 &cert, const char *hash=0, bool nowrap=true) |
Returns the base64-encoded DER encoding of a certifiate's public key in SubjectPublicKeyInfo format. More... | |
static XSECCryptoKey * | fromDEREncoding (const char *buf, unsigned long buflen, bool base64=true) |
Decodes a DER-encoded public key. More... | |
static XSECCryptoKey * | fromDEREncoding (const XMLCh *buf) |
Decodes a base64-encoded and DER-encoded public key. More... | |
A helper class for working with keys, certificates, etc.
|
static |
Performs a hash operation over the supplied data.
hashAlg | name of hash algorithm, syntax specific to crypto provider |
buf | input data to hash |
buflen | length of input data |
toHex | if true, hex-encodes the resulting raw bytes |
|
static |
Decodes a DER-encoded public key.
buf | DER encoded data |
buflen | length of data in bytes |
base64 | true iff DER is base64-encoded |
|
static |
Decodes a base64-encoded and DER-encoded public key.
buf | base64 and DER encoded data |
|
static |
Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
If a hash algorithm is provided, the data is digested before being base64-encoded.
cred | the credential containing the key to encode |
hash | optional name of hash algorithm, syntax specific to crypto provider |
nowrap | if true, any linefeeds will be stripped from the result |
|
static |
Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
If a hash algorithm is provided, the data is digested before being base64-encoded.
key | the key to encode |
hash | optional name of hash algorithm, syntax specific to crypto provider |
nowrap | if true, any linefeeds will be stripped from the result |
|
static |
Returns the base64-encoded DER encoding of a certifiate's public key in SubjectPublicKeyInfo format.
If a hash algorithm is provided, the data is digested before being base64-encoded.
cert | the certificate's key to encode |
hash | optional name of hash algorithm, syntax specific to crypto provider |
nowrap | if true, any linefeeds will be stripped from the result |
|
static |
Access a file to try and guess the encoding format used.
pathname | path to file |
|
static |
Loads certificate(s) from a local file.
certs | array to populate with certificate(s) |
pathname | path to file containing certificate(s) |
format | optional constant identifying certificate encoding format |
password | optional password to decrypt certificate(s) |
|
static |
Loads certificate(s) from a URL.
certs | array to populate with certificate(s) |
transport | object to use to acquire certificate(s) |
backing | backing file for certificate(s) (written to or read from if download fails) |
format | optional constant identifying certificate encoding format |
password | optional password to decrypt certificate(s) |
|
static |
Loads CRL(s) from a local file.
crls | array to populate with CRL(s) |
pathname | path to file containing CRL(s) |
format | optional constant identifying CRL encoding format |
|
static |
Loads CRL(s) from a URL.
crls | array to populate with CRL(s) |
transport | object to use to acquire CRL(s) |
backing | backing file for CRL(s) (written to or read from if download fails) |
format | optional constant identifying CRL encoding format |
|
static |
Loads a private key from a local file.
pathname | path to file containing key |
format | optional constant identifying key encoding format |
password | optional password to decrypt key |
|
static |
Loads a private key from a URL.
transport | object to use to acquire key |
backing | backing file for key (written to or read from if download fails) |
format | optional constant identifying key encoding format |
password | optional password to decrypt key |
|
static |
Compares two keys for equality.
key1 | first key to compare |
key2 | second key to compare |