Make hex encoding optional to allow replacement of deprecated version.
[shibboleth/cpp-xmltooling.git] / xmltooling / security / SecurityHelper.h
index babf720..4f2bc7e 100644 (file)
@@ -133,6 +133,17 @@ namespace xmltooling {
         static bool matches(const XSECCryptoKey& key1, const XSECCryptoKey& key2);
 
         /**
+         * Performs a hash operation over the supplied data.
+         *
+         * @param hashAlg   name of hash algorithm, syntax specific to crypto provider
+         * @param buf       input data to hash
+         * @param buflen    length of input data
+         * @param toHex     if true, hex-encodes the resulting raw bytes
+         * @return  result of hash operation, or an empty string
+         */
+        static std::string doHash(const char* hashAlg, const char* buf, unsigned long buflen, bool toHex=true);
+
+        /**
          * Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
          * <p>If a hash algorithm is provided, the data is digested before being base64-encoded.
          *