blautenb 2003/10/19 03:57:54
Modified: c/src/enc XSECCryptoKeyRSA.hpp XSECCryptoSymmetricKey.hpp
XSECCryptoX509.hpp
c/src/enc/OpenSSL OpenSSLCryptoKeyRSA.cpp
OpenSSLCryptoKeyRSA.hpp
OpenSSLCryptoSymmetricKey.cpp
OpenSSLCryptoSymmetricKey.hpp OpenSSLCryptoX509.cpp
OpenSSLCryptoX509.hpp
c/src/enc/WinCAPI WinCAPICryptoKeyRSA.cpp
WinCAPICryptoKeyRSA.hpp WinCAPICryptoX509.cpp
WinCAPICryptoX509.hpp
Log:
Support for RSA encryption + AES 192 and 256
Revision Changes Path
1.6 +73 -1 xml-security/c/src/enc/XSECCryptoKeyRSA.hpp
Index: XSECCryptoKeyRSA.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoKeyRSA.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSECCryptoKeyRSA.hpp 5 Jul 2003 10:30:32 -0000 1.5
+++ XSECCryptoKeyRSA.hpp 19 Oct 2003 10:57:54 -0000 1.6
@@ -89,6 +89,20 @@
public :
+ /**
+ * \brief Padding type
+ *
+ * Type of padding to be used for RSA encrypt/decrypt operations
+ */
+
+ enum PaddingType {
+
+ PAD_NONE = 0, /** No padding (Illegal
for all enc ops) */
+ PAD_PKCS_1_5 = 1, /** PKCS 1.5 padding */
+ PAD_OAEP = 2 /** OAEP */
+
+ };
+
/** @name Constructors and Destructors */
//@{
@@ -164,6 +178,64 @@
unsigned int hashLen,
char * base64SignatureBuf,
unsigned int base64SignatureBufLen) = 0;
+
+ /**
+ * \brief Decrypt using private key
+ *
+ * The library will call this function to decrypt a piece of cipher
+ * text using the private component of this key.
+ *
+ * @param inBuf cipher text to decrypt
+ * @param plainBuf output buffer for decrypted bytes
+ * @param inLength bytes of cipher text to decrypt
+ * @param maxOutLength size of outputBuffer
+ * @param padding Type of padding (PKCS 1.5 or OAEP)
+ * @param hm Hash Method for OAEP encryption
+ * @param OAEPParam OAEP Parameter String (NULL if none)
+ * @param OEAPParamLen Length of OAEPParam string
+ */
+
+ virtual unsigned int privateDecrypt(const unsigned char * inBuf,
+ unsigned char
* plainBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen) = 0;
+
+ /**
+ * \brief Encrypt using a public key
+ *
+ * The library will call this function to encrypt a plain text buffer
+ * using the public component of this key.
+ *
+ * @param inBuf plain text to decrypt
+ * @param cipherBuf output buffer for decrypted bytes
+ * @param inLength bytes of plain text to encrypt
+ * @param maxOutLength size of outputBuffer
+ * @param padding Type of padding (PKCS 1.5 or OAEP)
+ * @param hm Hash Method for OAEP encryption
+ * @param OAEPParam OAEP Parameter String (NULL if none)
+ * @param OEAPParamLen Length of OAEPParam string
+ */
+
+ virtual unsigned int publicEncrypt(const unsigned char * inBuf,
+ unsigned char
* cipherBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen) = 0;
+
+ /**
+ * \brief Obtain the length of an RSA key
+ *
+ * @returns The length of the rsa key (in bytes)
+ */
+
+ virtual unsigned int getLength(void) = 0;
//@}
1.5 +6 -2 xml-security/c/src/enc/XSECCryptoSymmetricKey.hpp
Index: XSECCryptoSymmetricKey.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoSymmetricKey.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSECCryptoSymmetricKey.hpp 13 Oct 2003 11:07:17 -0000 1.4
+++ XSECCryptoSymmetricKey.hpp 19 Oct 2003 10:57:54 -0000 1.5
@@ -108,7 +108,11 @@
KEY_3DES_CBC_192, /** 192 bit (3-Key)
3DES */
KEY_AES_CBC_128, /** 128 bit AES in CBC
mode */
- KEY_AES_ECB_128 /** 128 bit AES in ECB
mode */
+ KEY_AES_CBC_192, /** 192 bit AES in CBC
mode */
+ KEY_AES_CBC_256, /** 256 bit AES in CBC
mode */
+ KEY_AES_ECB_128, /** 128 bit AES in ECB
mode */
+ KEY_AES_ECB_192, /** 192 bit AES in ECB
mode */
+ KEY_AES_ECB_256 /** 256 bit AES in ECB
mode */
};
1.7 +7 -1 xml-security/c/src/enc/XSECCryptoX509.hpp
Index: XSECCryptoX509.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/XSECCryptoX509.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSECCryptoX509.hpp 5 Jul 2003 10:30:32 -0000 1.6
+++ XSECCryptoX509.hpp 19 Oct 2003 10:57:54 -0000 1.7
@@ -123,6 +123,12 @@
virtual XSECCryptoKey * clonePublicKey() = 0;
+ /**
+ * \brief Returns a string that identifies the crypto owner of this
library.
+ */
+
+ virtual const XMLCh * getProviderName() = 0;
+
//@}
/** @name Load and Get the certificate */
1.8 +122 -1 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoKeyRSA.cpp
Index: OpenSSLCryptoKeyRSA.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoKeyRSA.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- OpenSSLCryptoKeyRSA.cpp 5 Jul 2003 10:30:33 -0000 1.7
+++ OpenSSLCryptoKeyRSA.cpp 19 Oct 2003 10:57:54 -0000 1.8
@@ -361,7 +361,128 @@
return sigValLen;
}
+//
--------------------------------------------------------------------------------
+// decrypt a buffer
+//
--------------------------------------------------------------------------------
+unsigned int OpenSSLCryptoKeyRSA::privateDecrypt(const unsigned char * inBuf,
+ unsigned char
* plainBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen) {
+
+ // Perform a decrypt
+ if (mp_rsaKey == NULL) {
+
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "OpenSSL:RSA - Attempt to encrypt data with empty key");
+ }
+
+ int decryptSize;
+
+ switch (padding) {
+
+ case XSECCryptoKeyRSA::PAD_PKCS_1_5 :
+
+ decryptSize = RSA_private_decrypt(inLength,
+ inBuf,
+ plainBuf,
+ mp_rsaKey,
+ RSA_PKCS1_PADDING);
+
+ if (decryptSize < 0) {
+
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "OpenSSL:RSA privateKeyDecrypt - Error
Decrypting PKCS1_5 padded RSA encrypt");
+
+ }
+
+ break;
+
+ default :
+
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "OpenSSL:RSA - Unknown padding method");
+
+ }
+
+
+ return decryptSize;
+
+}
+
+//
--------------------------------------------------------------------------------
+// encrypt a buffer
+//
--------------------------------------------------------------------------------
+
+unsigned int OpenSSLCryptoKeyRSA::publicEncrypt(const unsigned char * inBuf,
+ unsigned char
* cipherBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen) {
+
+ // Perform an encrypt
+ if (mp_rsaKey == NULL) {
+
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "OpenSSL:RSA - Attempt to encrypt data with empty key");
+ }
+
+ int encryptSize;
+
+ switch (padding) {
+
+ case XSECCryptoKeyRSA::PAD_PKCS_1_5 :
+
+ encryptSize = RSA_public_encrypt(inLength,
+ inBuf,
+ cipherBuf,
+ mp_rsaKey,
+ RSA_PKCS1_PADDING);
+
+ if (encryptSize < 0) {
+
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "OpenSSL:RSA publicKeyDecrypt - Error
performing PKCS1_5 padded RSA encrypt");
+
+ }
+
+ break;
+
+ default :
+
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "OpenSSL:RSA - Unknown padding method");
+
+ }
+
+
+ return encryptSize;
+
+}
+
+//
--------------------------------------------------------------------------------
+// Size in bytes
+//
--------------------------------------------------------------------------------
+
+unsigned int OpenSSLCryptoKeyRSA::getLength(void) {
+
+ if (mp_rsaKey != NULL)
+ return RSA_size(mp_rsaKey);
+
+ return 0;
+
+}
+
+//
--------------------------------------------------------------------------------
+// Clone this key
+//
--------------------------------------------------------------------------------
XSECCryptoKey * OpenSSLCryptoKeyRSA::clone() {
1.7 +60 -1 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp
Index: OpenSSLCryptoKeyRSA.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- OpenSSLCryptoKeyRSA.hpp 5 Jul 2003 10:30:33 -0000 1.6
+++ OpenSSLCryptoKeyRSA.hpp 19 Oct 2003 10:57:54 -0000 1.7
@@ -170,6 +170,65 @@
char * base64SignatureBuf,
unsigned int base64SignatureBufLen);
+ /**
+ * \brief Decrypt using private key
+ *
+ * The library will call this function to decrypt a piece of cipher
+ * text using the private component of this key.
+ *
+ * @param inBuf cipher text to decrypt
+ * @param plainBuf output buffer for decrypted bytes
+ * @param inLength bytes of cipher text to decrypt
+ * @param maxOutLength size of outputBuffer
+ * @param padding Type of padding (PKCS 1.5 or OAEP)
+ * @param hm Hash Method for OAEP encryption
+ * @param OAEPParam OAEP Parameter String (NULL if none)
+ * @param OEAPParamLen Length of OAEPParam string
+ */
+
+ virtual unsigned int privateDecrypt(const unsigned char * inBuf,
+ unsigned char
* plainBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen);
+
+
+ /**
+ * \brief Encrypt using a public key
+ *
+ * The library will call this function to encrypt a plain text buffer
+ * using the public component of this key.
+ *
+ * @param inBuf plain text to decrypt
+ * @param cipherBuf output buffer for decrypted bytes
+ * @param inLength bytes of plain text to encrypt
+ * @param maxOutLength size of outputBuffer
+ * @param padding Type of padding (PKCS 1.5 or OAEP)
+ * @param hm Hash Method for OAEP encryption
+ * @param OAEPParam OAEP Parameter String (NULL if none)
+ * @param OEAPParamLen Length of OAEPParam string
+ */
+
+ virtual unsigned int publicEncrypt(const unsigned char * inBuf,
+ unsigned char
* cipherBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen);
+
+ /**
+ * \brief Obtain the length of an RSA key
+ *
+ * @returns The length of the rsa key (in bytes)
+ */
+
+ virtual unsigned int getLength(void);
+
//@}
/** @name Optional Interface methods
1.7 +134 -1
xml-security/c/src/enc/OpenSSL/OpenSSLCryptoSymmetricKey.cpp
Index: OpenSSLCryptoSymmetricKey.cpp
===================================================================
RCS file:
/home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoSymmetricKey.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- OpenSSLCryptoSymmetricKey.cpp 15 Oct 2003 07:54:53 -0000 1.6
+++ OpenSSLCryptoSymmetricKey.cpp 19 Oct 2003 10:57:54 -0000 1.7
@@ -197,6 +197,40 @@
m_ivSize = 16;
break;
+
+ case (XSECCryptoSymmetricKey::KEY_AES_CBC_192) :
+
+ // An AES key
+
+ if (iv == NULL) {
+
+ return 0; // Cannot initialise without an IV
+
+ }
+
+ EVP_DecryptInit_ex(&m_ctx, EVP_aes_192_cbc(), NULL,
m_keyBuf.rawBuffer(), iv);
+
+ m_blockSize = 16;
+ m_ivSize = 16;
+
+ break;
+
+ case (XSECCryptoSymmetricKey::KEY_AES_CBC_256) :
+
+ // An AES key
+
+ if (iv == NULL) {
+
+ return 0; // Cannot initialise without an IV
+
+ }
+
+ EVP_DecryptInit_ex(&m_ctx, EVP_aes_256_cbc(), NULL,
m_keyBuf.rawBuffer(), iv);
+
+ m_blockSize = 16;
+ m_ivSize = 16;
+
+ break;
case (XSECCryptoSymmetricKey::KEY_AES_ECB_128) :
@@ -209,6 +243,28 @@
break;
+ case (XSECCryptoSymmetricKey::KEY_AES_ECB_192) :
+
+ // An AES key
+
+ EVP_DecryptInit_ex(&m_ctx, EVP_aes_192_ecb(), NULL,
m_keyBuf.rawBuffer(), NULL);
+
+ m_blockSize = 16;
+ m_ivSize = 0;
+
+ break;
+
+ case (XSECCryptoSymmetricKey::KEY_AES_ECB_256) :
+
+ // An AES key
+
+ EVP_DecryptInit_ex(&m_ctx, EVP_aes_256_ecb(), NULL,
m_keyBuf.rawBuffer(), NULL);
+
+ m_blockSize = 16;
+ m_ivSize = 0;
+
+ break;
+
default :
// Cannot do this without an IV
@@ -232,6 +288,7 @@
bool OpenSSLCryptoSymmetricKey::decryptInit(bool doPad, const unsigned char
* iv) {
m_doPad = doPad;
+ m_initialised = false;
decryptCtxInit(iv);
return true;
@@ -294,6 +351,7 @@
unsigned int maxOutLength) {
int outl = maxOutLength;
+ m_initialised = false;
if (EVP_DecryptFinal_ex(&m_ctx, plainBuf, &outl) == 0) {
@@ -420,6 +478,58 @@
break;
+ case (XSECCryptoSymmetricKey::KEY_AES_CBC_192) :
+
+ // An AES key
+
+ if (iv == NULL) {
+
+ bool res = ((RAND_status() == 1) && (RAND_bytes(genIV,
16) == 1));
+ if (res == false) {
+ throw
XSECCryptoException(XSECCryptoException::SymmetricError,
+ "OpenSSL:SymmetricKey - Error
generating random IV");
+ }
+
+ usedIV = genIV;
+
+ }
+ else
+ usedIV = iv;
+
+ EVP_EncryptInit_ex(&m_ctx, EVP_aes_192_cbc(), NULL,
m_keyBuf.rawBuffer(), usedIV);
+
+ m_blockSize = 16;
+ m_ivSize = 16;
+ memcpy(m_lastBlock, usedIV, m_ivSize);
+
+ break;
+
+ case (XSECCryptoSymmetricKey::KEY_AES_CBC_256) :
+
+ // An AES key
+
+ if (iv == NULL) {
+
+ bool res = ((RAND_status() == 1) && (RAND_bytes(genIV,
16) == 1));
+ if (res == false) {
+ throw
XSECCryptoException(XSECCryptoException::SymmetricError,
+ "OpenSSL:SymmetricKey - Error
generating random IV");
+ }
+
+ usedIV = genIV;
+
+ }
+ else
+ usedIV = iv;
+
+ EVP_EncryptInit_ex(&m_ctx, EVP_aes_256_cbc(), NULL,
m_keyBuf.rawBuffer(), usedIV);
+
+ m_blockSize = 16;
+ m_ivSize = 16;
+ memcpy(m_lastBlock, usedIV, m_ivSize);
+
+ break;
+
case (XSECCryptoSymmetricKey::KEY_AES_ECB_128) :
// An AES key
@@ -431,6 +541,28 @@
break;
+ case (XSECCryptoSymmetricKey::KEY_AES_ECB_192) :
+
+ // An AES key
+
+ EVP_EncryptInit_ex(&m_ctx, EVP_aes_192_ecb(), NULL,
m_keyBuf.rawBuffer(), NULL);
+
+ m_blockSize = 16;
+ m_ivSize = 0;
+
+ break;
+
+ case (XSECCryptoSymmetricKey::KEY_AES_ECB_256) :
+
+ // An AES key
+
+ EVP_EncryptInit_ex(&m_ctx, EVP_aes_256_ecb(), NULL,
m_keyBuf.rawBuffer(), NULL);
+
+ m_blockSize = 16;
+ m_ivSize = 0;
+
+ break;
+
default :
// Cannot do this without an IV
@@ -499,6 +631,7 @@
unsigned int maxOutLength) {
int outl = maxOutLength;
+ m_initialised = false;
if (EVP_EncryptFinal_ex(&m_ctx, cipherBuf, &outl) == 0) {
1.6 +2 -2
xml-security/c/src/enc/OpenSSL/OpenSSLCryptoSymmetricKey.hpp
Index: OpenSSLCryptoSymmetricKey.hpp
===================================================================
RCS file:
/home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoSymmetricKey.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- OpenSSLCryptoSymmetricKey.hpp 15 Oct 2003 07:54:53 -0000 1.5
+++ OpenSSLCryptoSymmetricKey.hpp 19 Oct 2003 10:57:54 -0000 1.6
@@ -83,7 +83,7 @@
#include <openssl/evp.h>
-#define MAX_BLOCK_SIZE 8
+#define MAX_BLOCK_SIZE 32
/**
* \ingroup opensslcrypto
1.7 +7 -1 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoX509.cpp
Index: OpenSSLCryptoX509.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoX509.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- OpenSSLCryptoX509.cpp 5 Jul 2003 10:30:33 -0000 1.6
+++ OpenSSLCryptoX509.cpp 19 Oct 2003 10:57:54 -0000 1.7
@@ -187,6 +187,12 @@
// Info functions
+const XMLCh * OpenSSLCryptoX509::getProviderName() {
+
+ return DSIGConstants::s_unicodeStrPROVOpenSSL;
+
+}
+
XSECCryptoKey::KeyType OpenSSLCryptoX509::getPublicKeyType() {
if (mp_X509 == NULL) {
1.6 +13 -1 xml-security/c/src/enc/OpenSSL/OpenSSLCryptoX509.hpp
Index: OpenSSLCryptoX509.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/OpenSSL/OpenSSLCryptoX509.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- OpenSSLCryptoX509.hpp 5 Jul 2003 10:30:33 -0000 1.5
+++ OpenSSLCryptoX509.hpp 19 Oct 2003 10:57:54 -0000 1.6
@@ -114,6 +114,12 @@
virtual XSECCryptoKey::KeyType getPublicKeyType();
/**
+ * \brief Returns a string that identifies the crypto owner of this
library.
+ */
+
+ virtual const XMLCh * getProviderName();
+
+ /**
* \brief Get a copy of the public key.
*
* Extracts the public key from the certificate and returns the
appropriate
@@ -159,6 +165,12 @@
*/
OpenSSLCryptoX509(X509 * x);
+
+ /**
+ * \brief Get OpenSSL certificate structure
+ */
+
+ X509 * getOpenSSLX509(void) {return mp_X509;}
//@}
1.4 +23 -1 xml-security/c/src/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp
Index: WinCAPICryptoKeyRSA.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoKeyRSA.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- WinCAPICryptoKeyRSA.cpp 12 Oct 2003 06:23:17 -0000 1.3
+++ WinCAPICryptoKeyRSA.cpp 19 Oct 2003 10:57:54 -0000 1.4
@@ -495,6 +495,28 @@
}
//
--------------------------------------------------------------------------------
+// Size in bytes
+//
--------------------------------------------------------------------------------
+
+unsigned int WinCAPICryptoKeyRSA::getLength(void) {
+
+ DWORD len;
+ DWORD pLen = 4;
+
+ if (!CryptGetKeyParam(m_key,
+ KP_BLOCKLEN,
+ (BYTE *) &len,
+ &pLen,
+ 0)) {
+ throw XSECCryptoException(XSECCryptoException::RSAError,
+ "WinCAPI:RSA - Error determining key size");
+ }
+
+ return len / 8;
+
+}
+
+//
--------------------------------------------------------------------------------
// Some utility functions
//
--------------------------------------------------------------------------------
1.5 +59 -1 xml-security/c/src/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp
Index: WinCAPICryptoKeyRSA.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoKeyRSA.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WinCAPICryptoKeyRSA.hpp 12 Oct 2003 06:23:17 -0000 1.4
+++ WinCAPICryptoKeyRSA.hpp 19 Oct 2003 10:57:54 -0000 1.5
@@ -213,6 +213,64 @@
char *
base64SignatureBuf,
unsigned int
base64SignatureBufLen);
+ /**
+ * \brief Decrypt using private key
+ *
+ * The library will call this function to decrypt a piece of cipher
+ * text using the private component of this key.
+ *
+ * @param inBuf cipher text to decrypt
+ * @param plainBuf output buffer for decrypted bytes
+ * @param inLength bytes of cipher text to decrypt
+ * @param maxOutLength size of outputBuffer
+ * @param padding Type of padding (PKCS 1.5 or OAEP)
+ * @param hm Hash Method for OAEP encryption
+ * @param OAEPParam OAEP Parameter String (NULL if none)
+ * @param OEAPParamLen Length of OAEPParam string
+ */
+
+ virtual unsigned int privateDecrypt(const unsigned char * inBuf,
+ unsigned char
* plainBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen) { return 0; /* Not implementd */}
+
+ /**
+ * \brief Encrypt using a public key
+ *
+ * The library will call this function to encrypt a plain text buffer
+ * using the public component of this key.
+ *
+ * @param inBuf plain text to decrypt
+ * @param cipherBuf output buffer for decrypted bytes
+ * @param inLength bytes of plain text to encrypt
+ * @param maxOutLength size of outputBuffer
+ * @param padding Type of padding (PKCS 1.5 or OAEP)
+ * @param hm Hash Method for OAEP encryption
+ * @param OAEPParam OAEP Parameter String (NULL if none)
+ * @param OEAPParamLen Length of OAEPParam string
+ */
+
+ virtual unsigned int publicEncrypt(const unsigned char * inBuf,
+ unsigned char
* cipherBuf,
+ unsigned int
inLength,
+ unsigned int
maxOutLength,
+ PaddingType
padding,
+ hashMethod hm,
+ const unsigned
char * OEAPParam,
+ unsigned int
OAPEParamLen) {return 0; /* Not implemented */}
+
+ /**
+ * \brief Obtain the length of an RSA key
+ *
+ * @returns The length of the rsa key (in bytes)
+ */
+
+ virtual unsigned int getLength(void);
+
//@}
/** @name Optional Interface methods
1.5 +7 -1 xml-security/c/src/enc/WinCAPI/WinCAPICryptoX509.cpp
Index: WinCAPICryptoX509.cpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoX509.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WinCAPICryptoX509.cpp 12 Oct 2003 06:23:17 -0000 1.4
+++ WinCAPICryptoX509.cpp 19 Oct 2003 10:57:54 -0000 1.5
@@ -129,6 +129,12 @@
// Info functions
+const XMLCh * WinCAPICryptoX509::getProviderName() {
+
+ return DSIGConstants::s_unicodeStrPROVWinCAPI;
+
+}
+
XSECCryptoKey::KeyType WinCAPICryptoX509::getPublicKeyType() {
if (mp_certContext == NULL) {
1.6 +7 -1 xml-security/c/src/enc/WinCAPI/WinCAPICryptoX509.hpp
Index: WinCAPICryptoX509.hpp
===================================================================
RCS file: /home/cvs/xml-security/c/src/enc/WinCAPI/WinCAPICryptoX509.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WinCAPICryptoX509.hpp 12 Oct 2003 06:23:17 -0000 1.5
+++ WinCAPICryptoX509.hpp 19 Oct 2003 10:57:54 -0000 1.6
@@ -133,6 +133,12 @@
virtual XSECCryptoKey * clonePublicKey();
+ /**
+ * \brief Returns a string that identifies the crypto owner of this
library.
+ */
+
+ virtual const XMLCh * getProviderName();
+
//@}
/** @name Load and Get the certificate */