Added support for digest algorithm SHA256

This commit is contained in:
Frode Roxrud Gill 2022-03-13 11:44:27 +01:00
parent 561746081f
commit cd59fabe79
3 changed files with 14 additions and 3 deletions

View File

@ -61,8 +61,9 @@ public:
/** Supported digest algorithms (used for fingerprint). */
enum DigestAlgorithm {
DIGEST_MD5, /**< MD5 digest */
DIGEST_SHA1 /**< SHA1 digest */
DIGEST_MD5,
DIGEST_SHA1,
DIGEST_SHA256
};

View File

@ -311,10 +311,15 @@ const byteArray X509Certificate_GnuTLS::getFingerprint(const DigestAlgorithm alg
galgo = GNUTLS_DIG_MD5;
break;
case DIGEST_SHA256:
galgo = GNUTLS_DIG_SHA256;
break;
default:
case DIGEST_SHA1:
galgo = GNUTLS_DIG_SHA;
galgo = GNUTLS_DIG_SHA1;
break;
}

View File

@ -556,6 +556,11 @@ const byteArray X509Certificate_OpenSSL::getFingerprint(const DigestAlgorithm al
digest = EVP_md5();
break;
case DIGEST_SHA256:
digest = EVP_sha256();
break;
default:
case DIGEST_SHA1: