Skip to content

Commit 527739b

Browse files
committed
[go/fixchain] Use normal convention for test files
1 parent f86e331 commit 527739b

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package fixchain
33
import (
44
"bytes"
55
"encoding/json"
6-
"encoding/pem"
7-
"errors"
86
"fmt"
97
"log"
108
"strings"
@@ -33,16 +31,6 @@ func (rc bytesReadCloser) Close() error {
3331
return nil
3432
}
3533

36-
// CertificateFromPEM takes a string representing a certificate in PEM format
37-
// and returns the corresponding x509.Certificate object.
38-
func CertificateFromPEM(pemBytes string) (*x509.Certificate, error) {
39-
block, _ := pem.Decode([]byte(pemBytes))
40-
if block == nil {
41-
return nil, errors.New("failed to decode PEM")
42-
}
43-
return x509.ParseCertificate(block.Bytes)
44-
}
45-
4634
// GetTestCertificateFromPEM returns an x509.Certificate from a certificate in
4735
// PEM format for testing purposes. Any errors in the PEM decoding process are
4836
// reported to the testing framework.

go/fixchain/util.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package fixchain
2+
3+
import (
4+
"encoding/pem"
5+
"errors"
6+
7+
"github.com/google/certificate-transparency/go/x509"
8+
)
9+
10+
// CertificateFromPEM takes a string representing a certificate in PEM format
11+
// and returns the corresponding x509.Certificate object.
12+
func CertificateFromPEM(pemBytes string) (*x509.Certificate, error) {
13+
block, _ := pem.Decode([]byte(pemBytes))
14+
if block == nil {
15+
return nil, errors.New("failed to decode PEM")
16+
}
17+
return x509.ParseCertificate(block.Bytes)
18+
}

0 commit comments

Comments
 (0)