-/*
- * Copyright 2001-2010 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/**
#include <xsec/enc/OpenSSL/OpenSSLCryptoX509.hpp>
#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyRSA.hpp>
#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyDSA.hpp>
-#include <xsec/enc/OpenSSL/OpenSSLCryptoKeyEC.hpp>
#include <xercesc/util/Base64.hpp>
+#ifdef WIN32
+# if (OPENSSL_VERSION_NUMBER >= 0x00907000)
+# define XMLTOOLING_OPENSSL_HAVE_EC 1
+# endif
+#endif
+
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
+# include <xsec/enc/OpenSSL/OpenSSLCryptoKeyEC.hpp>
+#endif
+
using namespace xmltooling::logging;
using namespace xmltooling;
using namespace std;
ret=new OpenSSLCryptoKeyDSA(pkey);
break;
-#ifdef XSEC_OPENSSL_HAVE_EC
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
case EVP_PKEY_EC:
ret=new OpenSSLCryptoKeyEC(pkey);
break;
return (dsa1 && dsa2 && BN_cmp(dsa1->priv_key,dsa2->priv_key) == 0);
}
-#ifdef XMLTOOLING_XMLSEC_ECC
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
// If one key is public or both, just compare the public key half.
if (key1.getKeyType()==XSECCryptoKey::KEY_EC_PUBLIC || key1.getKeyType()==XSECCryptoKey::KEY_EC_PAIR) {
if (key2.getKeyType()!=XSECCryptoKey::KEY_EC_PUBLIC && key2.getKeyType()!=XSECCryptoKey::KEY_EC_PAIR)
const RSA* rsa = nullptr;
const DSA* dsa = nullptr;
-#ifdef XMLTOOLING_XMLSEC_ECC
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
const EC_KEY* ec = nullptr;
#endif
return ret;
}
}
-#ifdef XMLTOOLING_XMLSEC_ECC
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
else if (key.getKeyType() == XSECCryptoKey::KEY_EC_PUBLIC || key.getKeyType() == XSECCryptoKey::KEY_EC_PAIR) {
ec = static_cast<const OpenSSLCryptoKeyEC&>(key).getOpenSSLEC();
if (!ec) {
i2d_RSA_PUBKEY_bio(chain, const_cast<RSA*>(rsa));
else if (dsa)
i2d_DSA_PUBKEY_bio(chain, const_cast<DSA*>(dsa));
-#ifdef XMLTOOLING_XMLSEC_ECC
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
else
i2d_EC_PUBKEY_bio(chain, const_cast<EC_KEY*>(ec));
#endif
ret = new OpenSSLCryptoKeyDSA(pkey);
break;
-#ifdef XMLTOOLING_XMLSEC_ECC
+#if defined(XMLTOOLING_XMLSEC_ECC) && defined(XMLTOOLING_OPENSSL_HAVE_EC)
case EVP_PKEY_EC:
ret = new OpenSSLCryptoKeyEC(pkey);
break;