You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2018/06/22 19:22:03 UTC
svn commit: r1834154 - in /santuario/xml-security-cpp/trunk: ./
xsec/samples/ xsec/tools/cipher/ xsec/tools/templatesign/
Author: scantor
Date: Fri Jun 22 19:22:03 2018
New Revision: 1834154
URL: http://svn.apache.org/viewvc?rev=1834154&view=rev
Log:
Clarify change log, and remove some OpenSSL-specifics from samples.
Added:
santuario/xml-security-cpp/trunk/xml-security-c-2.0.0.zip (with props)
Modified:
santuario/xml-security-cpp/trunk/CHANGELOG.txt
santuario/xml-security-cpp/trunk/xsec/samples/simpleDecrypt.cpp
santuario/xml-security-cpp/trunk/xsec/samples/simpleEncrypt.cpp
santuario/xml-security-cpp/trunk/xsec/samples/simpleHMAC.cpp
santuario/xml-security-cpp/trunk/xsec/samples/simpleValidate.cpp
santuario/xml-security-cpp/trunk/xsec/tools/cipher/XencInteropResolver.cpp
santuario/xml-security-cpp/trunk/xsec/tools/cipher/cipher.cpp
santuario/xml-security-cpp/trunk/xsec/tools/templatesign/templatesign.cpp
Modified: santuario/xml-security-cpp/trunk/CHANGELOG.txt
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/CHANGELOG.txt?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/CHANGELOG.txt (original)
+++ santuario/xml-security-cpp/trunk/CHANGELOG.txt Fri Jun 22 19:22:03 2018
@@ -1,4 +1,12 @@
-For subsequent changes, refer to the issue tracker.
+2.0.0
+=====================================
+This is a major upgrade of the library that includes both a small
+number of enumerated changes, and a large number of fairly minimal API
+changes across the entire library. For this release, and all future
+releases, please refer to the web site and/or issue tracker for a
+summary of changes.
+
+Below are older change logs maintained from earlier releases.
Changes since 1.7.0
=====================================
Added: santuario/xml-security-cpp/trunk/xml-security-c-2.0.0.zip
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xml-security-c-2.0.0.zip?rev=1834154&view=auto
==============================================================================
Binary file - no diff available.
Propchange: santuario/xml-security-cpp/trunk/xml-security-c-2.0.0.zip
------------------------------------------------------------------------------
svn:mime-type = application/zip
Modified: santuario/xml-security-cpp/trunk/xsec/samples/simpleDecrypt.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/samples/simpleDecrypt.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/samples/simpleDecrypt.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/samples/simpleDecrypt.cpp Fri Jun 22 19:22:03 2018
@@ -41,7 +41,12 @@
#include <xsec/framework/XSECException.hpp>
#include <xsec/xenc/XENCCipher.hpp>
-#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp>
+#ifdef XSEC_HAVE_OPENSSL
+# include <xsec/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp>
+# include <openssl/bio.h>
+# include <openssl/evp.h>
+# include <openssl/pem.h>
+#endif
#include "../utils/XSECDOMUtils.hpp"
@@ -54,10 +59,6 @@ XALAN_USING_XALAN(XalanTransformer)
// OpenSSL
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/pem.h>
-
XERCES_CPP_NAMESPACE_USE
char letter[] = "\n\
@@ -117,10 +118,10 @@ int main (int argc, char **argv) {
}
catch (const XMLException &e) {
- cerr << "Error during initialisation of Xerces" << endl;
+ cerr << "Error during initialization of libraries" << endl;
cerr << "Error Message = : "
<< e.getMessage() << endl;
-
+ return -1;
}
// Use xerces to parse the document
@@ -153,6 +154,7 @@ int main (int argc, char **argv) {
cipher = prov.newCipher(doc);
+#ifdef XSEC_HAVE_OPENSSL
/* Load the private key via OpenSSL and then wrap in an OpenSSLCrypto construct */
BIO * bioMem = BIO_new(BIO_s_mem());
BIO_puts(bioMem, s_privateKey);
@@ -162,6 +164,9 @@ int main (int argc, char **argv) {
OpenSSLCryptoKeyRSA * k = new OpenSSLCryptoKeyRSA(pk);
cipher->setKEK(k);
+#else
+ throw XSECException(XSECException::CryptoProviderError);
+#endif
/* Find the EncryptedData node */
DOMNode * encryptedNode = findXENCNode(doc, "EncryptedData");
Modified: santuario/xml-security-cpp/trunk/xsec/samples/simpleEncrypt.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/samples/simpleEncrypt.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/samples/simpleEncrypt.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/samples/simpleEncrypt.cpp Fri Jun 22 19:22:03 2018
@@ -37,15 +37,13 @@
#include <xsec/framework/XSECProvider.hpp>
#include <xsec/framework/XSECException.hpp>
+#include <xsec/utils/XSECPlatformUtils.hpp>
#include <xsec/xenc/XENCCipher.hpp>
#include <xsec/xenc/XENCEncryptedData.hpp>
#include <xsec/xenc/XENCEncryptedKey.hpp>
#include "../utils/XSECDOMUtils.hpp"
-#include <xsec/enc/OpenSSL/OpenSSLCryptoSymmetricKey.hpp>
-#include <xsec/enc/OpenSSL/OpenSSLCryptoX509.hpp>
-
// Xalan
#ifdef XSEC_HAVE_XALAN
@@ -53,10 +51,6 @@
XALAN_USING_XALAN(XalanTransformer)
#endif
-// OpenSSL
-
-#include <openssl/rand.h>
-
XERCES_CPP_NAMESPACE_USE
DOMElement * g_toEncrypt;
@@ -151,30 +145,14 @@ int main (int argc, char **argv) {
cipher = prov.newCipher(doc);
- /* Now generate a random key that we can use to encrypt the element
- *
- * First check the status of the random generation in OpenSSL
- */
-
- if (RAND_status() != 1) {
-
- cerr << "OpenSSL random generation not properly initialised" << endl;
- exit(1);
-
- }
+ /* Now generate a random key that we can use to encrypt the element */
unsigned char keyBuf[24];
- if (RAND_bytes(keyBuf, 24) == 0) {
-
- cerr << "Error obtaining 24 bytes of random from OpenSSL" << endl;
- exit(1);
-
- }
+ XSECPlatformUtils::g_cryptoProvider->getRandom(keyBuf, 24);
/* Wrap this in a Symmetric 3DES key */
- OpenSSLCryptoSymmetricKey * key =
- new OpenSSLCryptoSymmetricKey(XSECCryptoSymmetricKey::KEY_3DES_192);
+ XSECCryptoSymmetricKey * key = XSECPlatformUtils::g_cryptoProvider->keySymmetric(XSECCryptoSymmetricKey::KEY_3DES_192);
key->setKey(keyBuf, 24);
cipher->setKey(key);
@@ -184,7 +162,7 @@ int main (int argc, char **argv) {
/* Now lets create an EncryptedKey element to hold the generated key */
/* First lets load the public key in the certificate */
- OpenSSLCryptoX509 * x509 = new OpenSSLCryptoX509();
+ XSECCryptoX509* x509 = XSECPlatformUtils::g_cryptoProvider->X509();
x509->loadX509Base64Bin(cert, (unsigned int) strlen(cert));
/* Now set the Key Encrypting Key (NOTE: Not the normal key) */
Modified: santuario/xml-security-cpp/trunk/xsec/samples/simpleHMAC.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/samples/simpleHMAC.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/samples/simpleHMAC.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/samples/simpleHMAC.cpp Fri Jun 22 19:22:03 2018
@@ -40,8 +40,8 @@
#include <xsec/framework/XSECProvider.hpp>
#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyHMAC.hpp>
#include <xsec/framework/XSECException.hpp>
+#include <xsec/utils/XSECPlatformUtils.hpp>
#include "../utils/XSECDOMUtils.hpp"
@@ -146,7 +146,7 @@ int main (int argc, char **argv) {
// Set the HMAC Key to be the string "secret"
- OpenSSLCryptoKeyHMAC * hmacKey = new OpenSSLCryptoKeyHMAC();
+ XSECCryptoKeyHMAC* hmacKey = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
hmacKey->setKey((unsigned char *) "secret", (unsigned int) strlen("secret"));
sig->setSigningKey(hmacKey);
Modified: santuario/xml-security-cpp/trunk/xsec/samples/simpleValidate.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/samples/simpleValidate.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/samples/simpleValidate.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/samples/simpleValidate.cpp Fri Jun 22 19:22:03 2018
@@ -34,12 +34,11 @@
// XML-Security-C (XSEC)
-#include <xsec/framework/XSECProvider.hpp>
#include <xsec/dsig/DSIGReference.hpp>
-#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyHMAC.hpp>
-#include <xsec/framework/XSECException.hpp>
-#include <xsec/enc/OpenSSL/OpenSSLCryptoX509.hpp>
#include <xsec/enc/XSECCryptoException.hpp>
+#include <xsec/framework/XSECProvider.hpp>
+#include <xsec/framework/XSECException.hpp>
+#include <xsec/utils/XSECPlatformUtils.hpp>
#include "../utils/XSECDOMUtils.hpp"
@@ -173,9 +172,8 @@ int main (int argc, char **argv) {
try {
- // Use the OpenSSL interface objects to get a signing key
-
- OpenSSLCryptoX509 * x509 = new OpenSSLCryptoX509();
+ // Use the interface objects to get a signing key
+ XSECCryptoX509* x509 = XSECPlatformUtils::g_cryptoProvider->X509();
x509->loadX509Base64Bin(cert, (unsigned int) strlen(cert));
sig->load();
Modified: santuario/xml-security-cpp/trunk/xsec/tools/cipher/XencInteropResolver.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/tools/cipher/XencInteropResolver.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/tools/cipher/XencInteropResolver.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/tools/cipher/XencInteropResolver.cpp Fri Jun 22 19:22:03 2018
@@ -48,10 +48,6 @@ XERCES_CPP_NAMESPACE_USE
#include <iostream>
-#if !defined (XSEC_HAVE_OPENSSL) && !defined (XSEC_HAVE_WINCAPI) && !defined (XSEC_HAVE_NSS)
-# error Require OpenSSL or Windows Crypto API for the Merlin Resolver
-#endif
-
#if defined (XSEC_HAVE_OPENSSL)
# include <openssl/x509.h>
# include <openssl/pem.h>
Modified: santuario/xml-security-cpp/trunk/xsec/tools/cipher/cipher.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/tools/cipher/cipher.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/tools/cipher/cipher.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/tools/cipher/cipher.cpp Fri Jun 22 19:22:03 2018
@@ -98,10 +98,6 @@ XALAN_USING_XALAN(XalanTransformer)
#endif
-#if !defined (XSEC_HAVE_OPENSSL) && !defined(XSEC_HAVE_WINCAPI) && !defined(XSEC_HAVE_NSS)
-# error No available cryptoAPI
-#endif
-
#if defined (XSEC_HAVE_OPENSSL)
// OpenSSL
Modified: santuario/xml-security-cpp/trunk/xsec/tools/templatesign/templatesign.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/tools/templatesign/templatesign.cpp?rev=1834154&r1=1834153&r2=1834154&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/tools/templatesign/templatesign.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/tools/templatesign/templatesign.cpp Fri Jun 22 19:22:03 2018
@@ -775,14 +775,7 @@ int main(int argc, char **argv) {
else
#endif
if (_stricmp(argv[paramCount], "--hmackey") == 0 || _stricmp(argv[paramCount], "-h") == 0) {
-
-#if defined (XSEC_HAVE_OPENSSL)
- OpenSSLCryptoKeyHMAC * hmacKey = new OpenSSLCryptoKeyHMAC();
-#else
-# if defined (XSEC_HAVE_WINCAPI)
- WinCAPICryptoKeyHMAC * hmacKey = new WinCAPICryptoKeyHMAC(0);
-# endif
-#endif
+ XSECCryptoKeyHMAC* hmacKey = XSECPlatformUtils::g_cryptoProvider->keyHMAC();
hmacKey->setKey((unsigned char *) argv[paramCount + 1], (unsigned int) strlen(argv[paramCount + 1]));
key = hmacKey;
paramCount += 2;