From 895f5e75273f3d86b5b2d1655ebecaf43399503f Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Fri, 14 Sep 2012 15:28:21 +0200 Subject: [PATCH] export this function as users will need it --- tlsa.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tlsa.go b/tlsa.go index 297873c3..25bbbdef 100644 --- a/tlsa.go +++ b/tlsa.go @@ -12,8 +12,8 @@ import ( // TLSA support functions -// certToTLSACert returns the hex data suitable for inclusion in a TLSA record -func certToTLSACert(selector, matchingType uint8, cert *x509.Certificate) string { +// CertificateToDANE converts a certificate to a hex string as used in the TLSA record. +func CertificateToDANE(selector, matchingType uint8, cert *x509.Certificate) string { switch matchingType { case 0: switch selector { @@ -51,14 +51,14 @@ func (r *RR_TLSA) Sign(usage, selector, matchingType int, cert *x509.Certificate r.Selector = uint8(selector) r.MatchingType = uint8(matchingType) - r.Certificate = certToTLSACert(r.Selector, r.MatchingType, cert) + r.Certificate = CertificateToDANE(r.Selector, r.MatchingType, cert) return nil } // Verify verifies a TLSA record against a SSL certificate. If it is OK // a nil error is returned. func (r *RR_TLSA) Verify(cert *x509.Certificate) error { - if r.Certificate == certToTLSACert(r.Selector, r.MatchingType, cert) { + if r.Certificate == CertificateToDANE(r.Selector, r.MatchingType, cert) { return nil } return ErrSig // ErrSig, really?