- if (gnutls_x509_crt_get_fingerprint(cert, GNUTLS_DIG_SHA1, digest, &digest_size) < 0)
+ switch(method)
+ {
+ case RB_SSL_CERTFP_METH_SHA1:
+ algo = GNUTLS_DIG_SHA1;
+ len = RB_SSL_CERTFP_LEN_SHA1;
+ break;
+ case RB_SSL_CERTFP_METH_SHA256:
+ algo = GNUTLS_DIG_SHA256;
+ len = RB_SSL_CERTFP_LEN_SHA256;
+ break;
+ case RB_SSL_CERTFP_METH_SHA512:
+ algo = GNUTLS_DIG_SHA512;
+ len = RB_SSL_CERTFP_LEN_SHA512;
+ break;
+ default:
+ return 0;
+ }
+
+ if (gnutls_x509_crt_get_fingerprint(cert, algo, digest, &digest_size) < 0)