From 11ecfabf484c53de21c6b907cd6eb5f870117482 Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Tue, 14 Sep 2010 01:40:09 +0000 Subject: [PATCH] Missing guards for xmlsec EC support. --- xmltooling/security/impl/BasicX509Credential.cpp | 14 ++++++++++++-- xmltooling/security/impl/SecurityHelper.cpp | 4 +++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/xmltooling/security/impl/BasicX509Credential.cpp b/xmltooling/security/impl/BasicX509Credential.cpp index 5d761ea..324d0f6 100644 --- a/xmltooling/security/impl/BasicX509Credential.cpp +++ b/xmltooling/security/impl/BasicX509Credential.cpp @@ -206,10 +206,12 @@ const char* BasicX509Credential::getAlgorithm() const case XSECCryptoKey::KEY_DSA_PAIR: return "DSA"; +#ifdef XMLTOOLING_XMLSEC_ECC case XSECCryptoKey::KEY_EC_PRIVATE: case XSECCryptoKey::KEY_EC_PUBLIC: case XSECCryptoKey::KEY_EC_PAIR: return "EC"; +#endif case XSECCryptoKey::KEY_HMAC: return "HMAC"; @@ -263,7 +265,11 @@ XSECCryptoKey* BasicX509Credential::getPrivateKey() const { if (m_key) { XSECCryptoKey::KeyType type = m_key->getKeyType(); - if (type!=XSECCryptoKey::KEY_RSA_PUBLIC && type!=XSECCryptoKey::KEY_DSA_PUBLIC && type!=XSECCryptoKey::KEY_EC_PUBLIC) + if (type != XSECCryptoKey::KEY_RSA_PUBLIC && type != XSECCryptoKey::KEY_DSA_PUBLIC +#ifdef XMLTOOLING_XMLSEC_ECC + && type != XSECCryptoKey::KEY_EC_PUBLIC +#endif + ) return m_key; } return nullptr; @@ -273,7 +279,11 @@ XSECCryptoKey* BasicX509Credential::getPublicKey() const { if (m_key) { XSECCryptoKey::KeyType type = m_key->getKeyType(); - if (type!=XSECCryptoKey::KEY_RSA_PRIVATE && type!=XSECCryptoKey::KEY_DSA_PRIVATE && type!=XSECCryptoKey::KEY_EC_PRIVATE) + if (type != XSECCryptoKey::KEY_RSA_PRIVATE && type != XSECCryptoKey::KEY_DSA_PRIVATE +#ifdef XMLTOOLING_XMLSEC_ECC + && type != XSECCryptoKey::KEY_EC_PRIVATE +#endif + ) return m_key; } return nullptr; diff --git a/xmltooling/security/impl/SecurityHelper.cpp b/xmltooling/security/impl/SecurityHelper.cpp index d847a60..9bbe7cc 100644 --- a/xmltooling/security/impl/SecurityHelper.cpp +++ b/xmltooling/security/impl/SecurityHelper.cpp @@ -37,7 +37,9 @@ #include #include #include -#include +#ifdef XMLTOOLING_XMLSEC_ECC +# include +#endif #include using namespace xmltooling::logging; -- 2.1.4