Skip to content

Commit

Permalink
Merge pull request #28 from cashapp/yunchi/self-sign
Browse files Browse the repository at this point in the history
--self-sign should import certificate
  • Loading branch information
mightyguava authored Jul 6, 2023
2 parents 82541d8 + b2b95de commit 87912b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/pivit/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ func commandGenerate(slot string, isP256, selfSign, generateCsr, assumeYes bool)
}
fmt.Println("Printing self-signed certificate:")
printCertificateRaw(certificate)

cert, err := x509.ParseCertificate(certificate)
if err != nil {
return errors.Wrap(err, "parse self-signed certificate")
}

if err := ImportCertificate(cert, yk, managementKey, slot); err != nil {
return errors.Wrap(err, "import self-signed certificate")
}
} else if generateCsr {
certRequest, err := certificateRequest(strconv.FormatUint(uint64(attestation.Serial), 10), privateKey)
if err != nil {
Expand Down

0 comments on commit 87912b9

Please sign in to comment.