mirror of https://github.com/docker/docs.git
Add root certificate to trusted store
This commit is contained in:
parent
71d2905066
commit
d63649e54c
|
@ -35,9 +35,14 @@ func (ccs *cliCryptoService) Create(role string) (*data.PublicKey, error) {
|
||||||
|
|
||||||
// PEM ENcode the certificate, which will be put directly inside of TUF's root.json
|
// PEM ENcode the certificate, which will be put directly inside of TUF's root.json
|
||||||
block := pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}
|
block := pem.Block{Type: "CERTIFICATE", Bytes: cert.Raw}
|
||||||
pemdata := string(pem.EncodeToMemory(&block))
|
pemdata := pem.EncodeToMemory(&block)
|
||||||
|
|
||||||
return data.NewPublicKey("RSA", pemdata), nil
|
// If this key has the role root, save it as a trusted certificate on our caStore
|
||||||
|
if role == "root" {
|
||||||
|
caStore.AddCertFromPEM(pemdata)
|
||||||
|
}
|
||||||
|
|
||||||
|
return data.NewPublicKey("RSA", string(pemdata)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sign returns the signatures for data with the given keyIDs
|
// Sign returns the signatures for data with the given keyIDs
|
||||||
|
|
Loading…
Reference in New Issue