Skip to content

Commit

Permalink
base64 encode timestamping cert chain (#340)
Browse files Browse the repository at this point in the history
Signed-off-by: Asra Ali <asraa@google.com>
  • Loading branch information
asraa authored Jun 24, 2021
1 parent 710784c commit e5dcf0a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"context"
"crypto/sha256"
"crypto/x509"
"encoding/base64"
"encoding/hex"
"encoding/pem"
"fmt"
Expand Down Expand Up @@ -114,9 +115,12 @@ func NewAPI() (*API, error) {
}

var certChain []*x509.Certificate
certChainStr := viper.GetString("rekor_server.timestamp_chain")
if certChainStr != "" {
var err error
b64CertChainStr := viper.GetString("rekor_server.timestamp_chain")
if b64CertChainStr != "" {
certChainStr, err := base64.StdEncoding.DecodeString(b64CertChainStr)
if err != nil {
return nil, errors.Wrap(err, "decoding timestamping cert")
}
if certChain, err = pki.ParseTimestampCertChain([]byte(certChainStr)); err != nil {
return nil, errors.Wrap(err, "parsing timestamp cert chain")
}
Expand Down

0 comments on commit e5dcf0a

Please sign in to comment.