blautenb    2003/10/19 04:01:39

  Modified:    c/src/dsig DSIGConstants.cpp DSIGConstants.hpp
                        DSIGKeyInfoX509.cpp DSIGKeyInfoX509.hpp
  Log:
  Support for RSA encryption + InputStream format output of decryption
  
  Revision  Changes    Path
  1.14      +20 -2     xml-security/c/src/dsig/DSIGConstants.cpp
  
  Index: DSIGConstants.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGConstants.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DSIGConstants.cpp 3 Oct 2003 09:55:02 -0000       1.13
  +++ DSIGConstants.cpp 19 Oct 2003 11:01:39 -0000      1.14
  @@ -101,7 +101,13 @@
   const XMLCh * DSIGConstants::s_unicodeStrURIXMLNS;
   const XMLCh * DSIGConstants::s_unicodeStrURIMANIFEST;
   const XMLCh * DSIGConstants::s_unicodeStrURI3DES_CBC;
  +const XMLCh * DSIGConstants::s_unicodeStrURIAES128_CBC;
  +const XMLCh * DSIGConstants::s_unicodeStrURIAES192_CBC;
  +const XMLCh * DSIGConstants::s_unicodeStrURIAES256_CBC;
   const XMLCh * DSIGConstants::s_unicodeStrURIKW_AES128;
  +const XMLCh * DSIGConstants::s_unicodeStrURIKW_AES192;
  +const XMLCh * DSIGConstants::s_unicodeStrURIKW_AES256;
  +const XMLCh * DSIGConstants::s_unicodeStrURIRSA_1_5;
   const XMLCh * DSIGConstants::s_unicodeStrPROVOpenSSL;
   const XMLCh * DSIGConstants::s_unicodeStrPROVWinCAPI;
   
  @@ -141,8 +147,14 @@
        s_unicodeStrURIMANIFEST = XMLString::transcode(URI_ID_MANIFEST);
        
        s_unicodeStrURI3DES_CBC = XMLString::transcode(URI_ID_3DES_CBC);
  +     s_unicodeStrURIAES128_CBC       = 
XMLString::transcode(URI_ID_AES128_CBC);
  +     s_unicodeStrURIAES192_CBC       = 
XMLString::transcode(URI_ID_AES192_CBC);
  +     s_unicodeStrURIAES256_CBC       = 
XMLString::transcode(URI_ID_AES256_CBC);
        s_unicodeStrURIKW_AES128 = XMLString::transcode(URI_ID_KW_AES128);
  -     
  +     s_unicodeStrURIKW_AES192 = XMLString::transcode(URI_ID_KW_AES192);
  +     s_unicodeStrURIKW_AES256 = XMLString::transcode(URI_ID_KW_AES256);
  +     s_unicodeStrURIRSA_1_5 = XMLString::transcode(URI_ID_RSA_1_5);
  +
        s_unicodeStrPROVOpenSSL = XMLString::transcode(PROV_OPENSSL);
        s_unicodeStrPROVWinCAPI = XMLString::transcode(PROV_WINCAPI);
   
  @@ -180,7 +192,13 @@
        delete[] (XMLCh *) s_unicodeStrURIMANIFEST;
   
        delete[] (XMLCh *) s_unicodeStrURI3DES_CBC;
  +     delete[] (XMLCh *) s_unicodeStrURIAES128_CBC;
  +     delete[] (XMLCh *) s_unicodeStrURIAES192_CBC;
  +     delete[] (XMLCh *) s_unicodeStrURIAES256_CBC;
        delete[] (XMLCh *) s_unicodeStrURIKW_AES128;
  +     delete[] (XMLCh *) s_unicodeStrURIKW_AES192;
  +     delete[] (XMLCh *) s_unicodeStrURIKW_AES256;
  +     delete[] (XMLCh *) s_unicodeStrURIRSA_1_5;
   
        delete[] (XMLCh *) s_unicodeStrPROVOpenSSL;
        delete[] (XMLCh *) s_unicodeStrPROVWinCAPI;
  
  
  
  1.16      +56 -7     xml-security/c/src/dsig/DSIGConstants.hpp
  
  Index: DSIGConstants.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGConstants.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DSIGConstants.hpp 3 Oct 2003 09:55:02 -0000       1.15
  +++ DSIGConstants.hpp 19 Oct 2003 11:01:39 -0000      1.16
  @@ -88,14 +88,22 @@
   
   // Hashing Algorithms
   
  -#define URI_ID_SHA1          "http://www.w3.org/2000/09/xmldsig#sha1";
  -#define URI_ID_MD5           "http://www.w3.org/2001/04/xmldsig-more#md5";
  +#define URI_ID_SHA1                  "http://www.w3.org/2000/09/xmldsig#sha1";
  +#define URI_ID_MD5                   
"http://www.w3.org/2001/04/xmldsig-more#md5";
   
   // Encryption Algorithms
  -#define URI_ID_3DES_CBC      "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
  +#define URI_ID_3DES_CBC              
"http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
  +#define URI_ID_AES128_CBC    "http://www.w3.org/2001/04/xmlenc#aes128-cbc";
  +#define URI_ID_AES192_CBC    "http://www.w3.org/2001/04/xmlenc#aes192-cbc";
  +#define URI_ID_AES256_CBC    "http://www.w3.org/2001/04/xmlenc#aes256-cbc";
   
   // Key Wrap Algorithm
  -#define URI_ID_KW_AES128 "http://www.w3.org/2001/04/xmlenc#kw-aes128";
  +#define URI_ID_KW_AES128     "http://www.w3.org/2001/04/xmlenc#kw-aes128";
  +#define URI_ID_KW_AES192     "http://www.w3.org/2001/04/xmlenc#kw-aes192";
  +#define URI_ID_KW_AES256     "http://www.w3.org/2001/04/xmlenc#kw-aes256";
  +
  +// Key Transport algorithms
  +#define URI_ID_RSA_1_5               
"http://www.w3.org/2001/04/xmlenc#rsa-1_5"; 
   
   // Transforms
   
  @@ -136,7 +144,6 @@
   
   // Enumerated Types
   
  -
   enum canonicalizationMethod {
   
        CANON_NONE                                      = 0,                    
// No method defined
  @@ -186,7 +193,13 @@
   
        ENCRYPT_NONE                    = 0,                            // No 
method defined
        ENCRYPT_3DES_CBC                = 1,                            // Use 
3DES
  -     ENCRYPT_KW_AES128               = 2                                     
// KeyWrap - AES128
  +     ENCRYPT_AES128_CBC              = 2,                            // 128 
bit AES in CBC mode
  +     ENCRYPT_AES192_CBC              = 3,                            // 192 
bit AES in CBC mode
  +     ENCRYPT_AES256_CBC              = 4,                            // 256 
bit AES in CBC mode
  +     ENCRYPT_KW_AES128               = 5,                            // 
KeyWrap - AES128
  +     ENCRYPT_KW_AES192               = 6,                            // 
KeyWrap - AES192
  +     ENCRYPT_KW_AES256               = 7,                            // 
KeyWrap - AES256
  +     ENCRYPT_RSA_15                  = 8                                     
// RSA with PKCS 1.5 padding
   
   };
   
  @@ -310,11 +323,41 @@
                uri = URI_ID_3DES_CBC;
                break;
   
  +     case (ENCRYPT_AES128_CBC) :
  +
  +             uri = URI_ID_AES128_CBC;
  +             break;
  +
  +     case (ENCRYPT_AES192_CBC) :
  +
  +             uri = URI_ID_AES192_CBC;
  +             break;
  +
  +     case (ENCRYPT_AES256_CBC) :
  +
  +             uri = URI_ID_AES256_CBC;
  +             break;
  +
        case (ENCRYPT_KW_AES128) :
   
                uri = URI_ID_KW_AES128;
                break;
   
  +     case (ENCRYPT_KW_AES192) :
  +
  +             uri = URI_ID_KW_AES192;
  +             break;
  +
  +     case (ENCRYPT_KW_AES256) :
  +
  +             uri = URI_ID_KW_AES256;
  +             break;
  +
  +     case (ENCRYPT_RSA_15) :
  +
  +             uri = URI_ID_RSA_1_5;
  +             break;
  +             
        default:
   
                return false;
  @@ -367,7 +410,13 @@
   
        // URIs for Encryption
        static const XMLCh * s_unicodeStrURI3DES_CBC;
  +     static const XMLCh * s_unicodeStrURIAES128_CBC; 
  +     static const XMLCh * s_unicodeStrURIAES192_CBC; 
  +     static const XMLCh * s_unicodeStrURIAES256_CBC; 
        static const XMLCh * s_unicodeStrURIKW_AES128;
  +     static const XMLCh * s_unicodeStrURIKW_AES192;
  +     static const XMLCh * s_unicodeStrURIKW_AES256;
  +     static const XMLCh * s_unicodeStrURIRSA_1_5;
   
        // Internal Crypto Providers
        static const XMLCh * s_unicodeStrPROVOpenSSL;
  
  
  
  1.11      +19 -1     xml-security/c/src/dsig/DSIGKeyInfoX509.cpp
  
  Index: DSIGKeyInfoX509.cpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoX509.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DSIGKeyInfoX509.cpp       6 Oct 2003 12:16:37 -0000       1.10
  +++ DSIGKeyInfoX509.cpp       19 Oct 2003 11:01:39 -0000      1.11
  @@ -137,6 +137,8 @@
   
        for (i = m_X509List.begin(); i != m_X509List.end(); ++i) {
   
  +             if ((*i)->mp_cryptoX509 != NULL)
  +                     delete ((*i)->mp_cryptoX509);
                delete (*i);
   
        }
  @@ -199,6 +201,10 @@
                                        m_X509List.push_back(h);
   
                                        h->mp_encodedX509 = 
certElt->getNodeValue();
  +                                     h->mp_cryptoX509 = 
XSECPlatformUtils::g_cryptoProvider->X509();
  +                                     char * charX509 = 
XMLString::transcode(h->mp_encodedX509);
  +                                     ArrayJanitor<char> j_charX509(charX509);
  +                                     
h->mp_cryptoX509->loadX509Base64Bin(charX509, strlen(charX509));
   
                                }
                        }
  @@ -369,6 +375,14 @@
   
   }
   
  +XSECCryptoX509 * DSIGKeyInfoX509::getCertificateCryptoItem(int item) {
  +
  +     if (item >=0 && (unsigned int) item < m_X509List.size())
  +             return m_X509List[item]->mp_cryptoX509;
  +
  +     return 0;
  +}
  +
   const XMLCh * DSIGKeyInfoX509::getRawRetrievalURI(void) {
   
        return mp_rawRetrievalURI;
  @@ -583,5 +597,9 @@
        X509Holder * h;
        XSECnew(h, X509Holder);
        h->mp_encodedX509 = b64Txt->getNodeValue();
  +     h->mp_cryptoX509 = XSECPlatformUtils::g_cryptoProvider->X509();
  +     char * charX509 = XMLString::transcode(h->mp_encodedX509);
  +     ArrayJanitor<char> j_charX509(charX509);
  +     h->mp_cryptoX509->loadX509Base64Bin(charX509, strlen(charX509));
        
   }
  
  
  
  1.9       +12 -1     xml-security/c/src/dsig/DSIGKeyInfoX509.hpp
  
  Index: DSIGKeyInfoX509.hpp
  ===================================================================
  RCS file: /home/cvs/xml-security/c/src/dsig/DSIGKeyInfoX509.hpp,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DSIGKeyInfoX509.hpp       12 Sep 2003 09:47:17 -0000      1.8
  +++ DSIGKeyInfoX509.hpp       19 Oct 2003 11:01:39 -0000      1.9
  @@ -268,6 +268,17 @@
        const XMLCh * getCertificateItem(int item);
   
        /**
  +      * \brief Get the Crypto Interface X509 structure version of the 
certificate
  +      *
  +      * Use the index to find the required certificate and return a pointer
  +      * to the XSECCryptoX509 cert
  +      *
  +      * @returns A pointer to the XSECCryptoX509 cert structure
  +      */
  +
  +     XSECCryptoX509 * getCertificateCryptoItem(int item);
  +
  +     /**
         * \brief Interface function to find the type of this KeyInfo
         */
        
  
  
  

Reply via email to