#if !defined(__xmltooling_sechelper_h__) && !defined(XMLTOOLING_NO_XMLSEC)
#define __xmltooling_sechelper_h__
-#include <xmltooling/security/XSECCryptoX509CRL.h>
-#include <xmltooling/soap/SOAPTransport.h>
+#include <xmltooling/base.h>
+#include <string>
#include <vector>
-#include <xsec/enc/XSECCryptoKey.hpp>
-#include <xsec/enc/XSECCryptoX509.hpp>
+
+class XSECCryptoKey;
+class XSECCryptoX509;
namespace xmltooling {
class XMLTOOL_API Credential;
+ class XMLTOOL_API SOAPTransport;
+ class XMLTOOL_API XSECCryptoX509CRL;
/**
* A helper class for working with keys, certificates, etc.
* @param certs array to populate with certificate(s)
* @param pathname path to file containing certificate(s)
* @param format optional constant identifying certificate encoding format
+ * @param password optional password to decrypt certificate(s)
* @return size of the resulting array
*/
static std::vector<XSECCryptoX509*>::size_type loadCertificatesFromFile(
* @param transport object to use to acquire certificate(s)
* @param backing backing file for certificate(s) (written to or read from if download fails)
* @param format optional constant identifying certificate encoding format
+ * @param password optional password to decrypt certificate(s)
* @return size of the resulting array
*/
static std::vector<XSECCryptoX509*>::size_type loadCertificatesFromURL(
/**
* Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
*
- * @param key the credential containing the key to encode
+ * @param cred the credential containing the key to encode
+ * @param hash if true, the DER encoded data is hashed with SHA-1 before base64 encoding
* @param nowrap if true, any linefeeds will be stripped from the result
+ * @param hashAlg name of hash algorithm, syntax specific to crypto provider
* @return the base64 encoded key value
*/
- static std::string getDEREncoding(const Credential& cred, bool nowrap=true);
+ static std::string getDEREncoding(const Credential& cred, bool hash=false, bool nowrap=true, const char* hashAlg="SHA1");
/**
* Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
*
- * @param key the key to encode
+ * @param key the key to encode
+ * @param hash if true, the DER encoded data is hashed with SHA-1 before base64 encoding
* @param nowrap if true, any linefeeds will be stripped from the result
+ * @param hashAlg name of hash algorithm, syntax specific to crypto provider
* @return the base64 encoded key value
*/
- static std::string getDEREncoding(const XSECCryptoKey& key, bool nowrap=true);
+ static std::string getDEREncoding(const XSECCryptoKey& key, bool hash=false, bool nowrap=true, const char* hashAlg="SHA1");
/**
* Returns the base64-encoded DER encoding of a certifiate's public key in SubjectPublicKeyInfo format.
*
- * @param cert the certificate's key to encode
+ * @param cert the certificate's key to encode
+ * @param hash if true, the DER encoded data is hashed with SHA-1 before base64 encoding
* @param nowrap if true, any linefeeds will be stripped from the result
+ * @param hashAlg name of hash algorithm, syntax specific to crypto provider
* @return the base64 encoded key value
*/
- static std::string getDEREncoding(const XSECCryptoX509& cert, bool nowrap=true);
+ static std::string getDEREncoding(const XSECCryptoX509& cert, bool hash=false, bool nowrap=true, const char* hashAlg="SHA1");
};
};