Skip to content

Commit e5dcf0a

Browse files
authored
base64 encode timestamping cert chain (sigstore#340)
Signed-off-by: Asra Ali <asraa@google.com>
1 parent 710784c commit e5dcf0a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/api/api.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"context"
2020
"crypto/sha256"
2121
"crypto/x509"
22+
"encoding/base64"
2223
"encoding/hex"
2324
"encoding/pem"
2425
"fmt"
@@ -114,9 +115,12 @@ func NewAPI() (*API, error) {
114115
}
115116

116117
var certChain []*x509.Certificate
117-
certChainStr := viper.GetString("rekor_server.timestamp_chain")
118-
if certChainStr != "" {
119-
var err error
118+
b64CertChainStr := viper.GetString("rekor_server.timestamp_chain")
119+
if b64CertChainStr != "" {
120+
certChainStr, err := base64.StdEncoding.DecodeString(b64CertChainStr)
121+
if err != nil {
122+
return nil, errors.Wrap(err, "decoding timestamping cert")
123+
}
120124
if certChain, err = pki.ParseTimestampCertChain([]byte(certChainStr)); err != nil {
121125
return nil, errors.Wrap(err, "parsing timestamp cert chain")
122126
}

0 commit comments

Comments
 (0)