diff --git a/src/crypt/certificate.vala b/src/crypt/certificate.vala index 0930c89..d8f207b 100644 --- a/src/crypt/certificate.vala +++ b/src/crypt/certificate.vala @@ -147,9 +147,9 @@ namespace Mconn { export_to_file(key_path, export_private_key(key)); } - private GnuTLS.X509.Certificate cert_from_pem(uint8[] certificate_pem) { - var datum = GnuTLS.Datum() { data=certificate_pem, - size=certificate_pem.length }; + private GnuTLS.X509.Certificate cert_from_pem(string certificate_pem) { + var datum = GnuTLS.Datum() { data=certificate_pem.data, + size=certificate_pem.data.length }; var cert = GnuTLS.X509.Certificate.create(); var res = cert.import(ref datum, GnuTLS.X509.CertificateFormat.PEM); @@ -164,7 +164,7 @@ namespace Mconn { * @param certificate_pem PEM encoded certificate * @return SHA1 fingerprint as bytes */ - public uint8[] fingerprint_certificate(uint8[] certificate_pem) { + public uint8[] fingerprint_certificate(string certificate_pem) { var cert = cert_from_pem(certificate_pem); // TOOD: make digest configurable, for now assume it's SHA1 diff --git a/test/mconn-crypt-vala-test.vala b/test/mconn-crypt-vala-test.vala index 4b5a863..311d4b9 100644 --- a/test/mconn-crypt-vala-test.vala +++ b/test/mconn-crypt-vala-test.vala @@ -107,7 +107,7 @@ sCmsSGcb9ZkEQfRNGTmFFthkcnfTU9mKh8oGc/a9r0DDgYcPSCgqERt2fgiBrt85 -----END CERTIFICATE-----"""; var expected = "eb2611a447085322b206fa61d4bc5869b4a55657"; - var fingerprint = Crypt.fingerprint_certificate(pem.data); + var fingerprint = Crypt.fingerprint_certificate(pem); // SHA1 assert(fingerprint.length == 20);