#include <PKIFXSECCryptoKeyRSA.h>
The xml security library uses instances of PKIFXSECCryptoKeyRSA to process RSA keys.
TSP-enforcing: No
Definition at line 27 of file PKIFXSECCryptoKeyRSA.h.
Public Member Functions | |
PKIFXSECCryptoKeyRSA () | |
virtual | ~PKIFXSECCryptoKeyRSA () |
virtual XSECCryptoKey * | clone () const |
virtual void | setOAEPparams (unsigned char *params, unsigned int paramsLen) |
virtual unsigned int | getOAEPparamsLen () const |
virtual const unsigned char * | getOAEPparams () const |
virtual bool | verifySHA1PKCS1Base64Signature (const unsigned char *hashBuf, unsigned int hashLen, const char *base64Signature, unsigned int sigLen, hashMethod hm) |
virtual unsigned int | signSHA1PKCS1Base64Signature (unsigned char *hashBuf, unsigned int hashLen, char *base64SignatureBuf, unsigned int base64SignatureBufLen, hashMethod hm) |
virtual unsigned int | privateDecrypt (const unsigned char *inBuf, unsigned char *plainBuf, unsigned int inLength, unsigned int maxOutLength, PaddingType padding, hashMethod hm) |
virtual unsigned int | publicEncrypt (const unsigned char *inBuf, unsigned char *cipherBuf, unsigned int inLength, unsigned int maxOutLength, PaddingType padding, hashMethod hm) |
virtual unsigned int | getLength () const |
virtual void | SetMediator (IPKIFMediatorPtr &med) |
virtual void | SetCredential (CPKIFCredentialPtr &cred) |
virtual void | SetKeyMaterial (CPKIFKeyMaterialPtr &km) |
virtual XSECCryptoKey::KeyType | getKeyType () const |
virtual const XMLCh * | getProviderName () const |
virtual void | loadPublicModulusBase64BigNums (const char *b64, unsigned int len) |
virtual void | loadPublicExponentBase64BigNums (const char *b64, unsigned int len) |
Protected Attributes | |
PKIFXSECCryptoKeyRSAImpl * | m_impl |
PKIFXSECCryptoKeyRSA::PKIFXSECCryptoKeyRSA | ( | ) |
Interface: External
Default Constructor: prepare an empty PKIFXSECCryptoKeyRSA object. SetMediator() must be called before this class can be used for any operations.
Definition at line 69 of file PKIFXSECCryptoKeyRSA.cpp.
Referenced by clone().
PKIFXSECCryptoKeyRSA::~PKIFXSECCryptoKeyRSA | ( | ) | [virtual] |
Interface: External
Frees resources used by a PKIFXSECCryptoKeyRSA object.
Definition at line 81 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
XSECCryptoKey * PKIFXSECCryptoKeyRSA::clone | ( | ) | const [virtual] |
Interface: External
Used by the apache xml security library to copy this object
Definition at line 96 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl, and PKIFXSECCryptoKeyRSA().
void PKIFXSECCryptoKeyRSA::setOAEPparams | ( | unsigned char * | params, | |
unsigned int | paramsLen | |||
) | [virtual] |
Interface: External
Set the OAEPparams string
This is not currently used by PKIF and is not needed with the default behavior of the library.
Definition at line 115 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
unsigned int PKIFXSECCryptoKeyRSA::getOAEPparamsLen | ( | ) | const [virtual] |
Interface: External
Get OAEPparams Length
Definition at line 127 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
const unsigned char * PKIFXSECCryptoKeyRSA::getOAEPparams | ( | ) | const [virtual] |
Interface: External
Get the OAEPparams buffer
Definition at line 140 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
bool PKIFXSECCryptoKeyRSA::verifySHA1PKCS1Base64Signature | ( | const unsigned char * | hashBuf, | |
unsigned int | hashLen, | |||
const char * | base64Signature, | |||
unsigned int | sigLen, | |||
hashMethod | hm | |||
) | [virtual] |
Interface: External
Verify a PKCS1 encoded signature
The xml security library will call this function to validate an RSA signature The standard by default uses SHA1 in a PKCS1 encoding.
hashBuf | [in] Buffer containing the pre-calculated (binary) digest |
hashLen | [in] Length of the data in the digest buffer |
base64Signature | [in] Buffer containing the Base64 encoded signature |
sigLen | [in] Length of the data in the signature buffer |
hm | [in] The type of hash that the signature is accross - must be a SHA variant |
Definition at line 172 of file PKIFXSECCryptoKeyRSA.cpp.
References CPKIFException::GetDescription(), m_impl, and IPKIFCryptoRawOperations::Verify().
unsigned int PKIFXSECCryptoKeyRSA::signSHA1PKCS1Base64Signature | ( | unsigned char * | hashBuf, | |
unsigned int | hashLen, | |||
char * | base64SignatureBuf, | |||
unsigned int | base64SignatureBufLen, | |||
hashMethod | hm | |||
) | [virtual] |
Interface: External Create a signature
The xml security library will call this function to create a signature from a pre-calculated digest. The output signature is required to be Base64 encoded such that it can be placed directly into the XML document
This call needs to do a PKCS1 encode for a SHA-1 signature.
hashBuf | [in] Buffer containing the pre-calculated (binary) digest |
hashLen | [in] Number of bytes of hash in the hashBuf |
base64SignatureBuf | [out] Buffer to place the base64 encoded result into |
base64SignatureBufLen | [in] size of base64SignatureBuf in bytes |
hm | [in] hash method used for the pre-calculated hash. Needed to place the correct OID in the signature |
Definition at line 223 of file PKIFXSECCryptoKeyRSA.cpp.
References CPKIFException::GetDescription(), getLength(), m_impl, and IPKIFCryptoKeyIDOperations::Sign().
unsigned int PKIFXSECCryptoKeyRSA::privateDecrypt | ( | const unsigned char * | inBuf, | |
unsigned char * | plainBuf, | |||
unsigned int | inLength, | |||
unsigned int | maxOutLength, | |||
PaddingType | padding, | |||
hashMethod | hm | |||
) | [virtual] |
Interface: External
Decrypt using private key
The library will call this function to decrypt a piece of cipher text using the private component of this key.
inBuf | [in] cipher text to decrypt |
plainBuf | [out] output buffer for decrypted bytes |
inLength | [in] bytes of cipher text to decrypt |
maxOutLength | [in] size of outputBuffer |
padding | [in] padding Type of padding (PKCS 1.5 only for this provider) |
hm | [in] Hash Method for OAEP encryption (not supported by PKIF) |
Definition at line 271 of file PKIFXSECCryptoKeyRSA.cpp.
References IPKIFCryptoKeyIDOperations::Decrypt(), CPKIFException::GetDescription(), and m_impl.
unsigned int PKIFXSECCryptoKeyRSA::publicEncrypt | ( | const unsigned char * | inBuf, | |
unsigned char * | cipherBuf, | |||
unsigned int | inLength, | |||
unsigned int | maxOutLength, | |||
PaddingType | padding, | |||
hashMethod | hm | |||
) | [virtual] |
Interface: External
Encrypt using a public key
The library will call this function to encrypt a plain text buffer using the public component of this key.
inBuf | [in] plain text to encrypt |
cipherBuf | [out] output buffer for encrypted bytes |
inLength | [in] bytes of plain text to encrypt |
maxOutLength | [in] size of cipherBuf |
padding | [in] padding Type of padding (PKCS 1.5 only for this provider) |
hm | [in] Hash Method for OAEP encryption (not supported by PKIF) |
Definition at line 316 of file PKIFXSECCryptoKeyRSA.cpp.
References IPKIFCryptoRawOperations::Encrypt(), CPKIFException::GetDescription(), and m_impl.
unsigned int PKIFXSECCryptoKeyRSA::getLength | ( | ) | const [virtual] |
Interface: External
Obtain the length of an RSA key
Definition at line 358 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
Referenced by signSHA1PKCS1Base64Signature().
void PKIFXSECCryptoKeyRSA::SetMediator | ( | IPKIFMediatorPtr & | med | ) | [virtual] |
Interface: External
Set the mediator this object will use to find crypto colleagues
med | [in] Pointer to a mediator object to be used |
Definition at line 392 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
Referenced by PKIFXSECCryptoX509::clonePublicKey(), PKIFXSECCrypto::keyRSA(), and PKIFXSECKeyInfoResolver::resolveKey().
void PKIFXSECCryptoKeyRSA::SetCredential | ( | CPKIFCredentialPtr & | cred | ) | [virtual] |
Interface: External
Set the credential this object will use to generate signatures
cred | [in] signing credential |
Definition at line 406 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
void PKIFXSECCryptoKeyRSA::SetKeyMaterial | ( | CPKIFKeyMaterialPtr & | km | ) | [virtual] |
Interface: External
Set the key material this object will use to verify signatures
km | [in] key material to use for verification |
Definition at line 420 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
Referenced by PKIFXSECCryptoX509::clonePublicKey(), and PKIFXSECKeyInfoResolver::resolveKey().
XSECCryptoKey::KeyType PKIFXSECCryptoKeyRSA::getKeyType | ( | ) | const [virtual] |
Interface: External
Determine whether the object has private key material
Definition at line 153 of file PKIFXSECCryptoKeyRSA.cpp.
References m_impl.
const XMLCh * PKIFXSECCryptoKeyRSA::getProviderName | ( | ) | const [virtual] |
Interface: External
Get the name of the provider
Definition at line 434 of file PKIFXSECCryptoKeyRSA.cpp.
References pkifProvName().
virtual void PKIFXSECCryptoKeyRSA::loadPublicModulusBase64BigNums | ( | const char * | b64, | |
unsigned int | len | |||
) | [inline, virtual] |
Interface: Module
Not supported by PKIF
Definition at line 89 of file PKIFXSECCryptoKeyRSA.h.
virtual void PKIFXSECCryptoKeyRSA::loadPublicExponentBase64BigNums | ( | const char * | b64, | |
unsigned int | len | |||
) | [inline, virtual] |
Interface: Module
Not supported by PKIF
Definition at line 97 of file PKIFXSECCryptoKeyRSA.h.
PKIFXSECCryptoKeyRSAImpl* PKIFXSECCryptoKeyRSA::m_impl [protected] |
Definition at line 79 of file PKIFXSECCryptoKeyRSA.h.
Referenced by clone(), getKeyType(), getLength(), getOAEPparams(), getOAEPparamsLen(), privateDecrypt(), publicEncrypt(), SetCredential(), SetKeyMaterial(), SetMediator(), setOAEPparams(), signSHA1PKCS1Base64Signature(), verifySHA1PKCS1Base64Signature(), and ~PKIFXSECCryptoKeyRSA().