MCPcopy
hub / github.com/smallstep/cli / CreateSigner

Function CreateSigner

internal/cryptoutil/cryptoutil.go:74–87  ·  view source on GitHub ↗

CreateSigner reads a key from a file with a given name or creates a signer with the given kms and name uri.

(kmsURI, name string, opts ...pemutil.Options)

Source from the content-addressed store, hash-verified

72// CreateSigner reads a key from a file with a given name or creates a signer
73// with the given kms and name uri.
74func CreateSigner(kmsURI, name string, opts ...pemutil.Options) (crypto.Signer, error) {
75 if isFilename(name) {
76 s, err := pemutil.Read(name, opts...)
77 if err != nil {
78 return nil, err
79 }
80 if sig, ok := s.(crypto.Signer); ok {
81 return sig, nil
82 }
83 return nil, fmt.Errorf("file %s does not contain a valid private key", name)
84 }
85
86 return newKMSSigner(kmsURI, name)
87}
88
89// LoadCertificate returns a x509.Certificate from a kms or file
90func LoadCertificate(kmsURI, certPath string) ([]*x509.Certificate, error) {

Callers 7

generateX5CTokenFunction · 0.92
GetCertificateMethod · 0.92
signActionFunction · 0.92
parseOrCreateKeyFunction · 0.92
parseSignerFunction · 0.92
rekeyCertificateActionFunction · 0.92
tlsLoadX509KeyPairFunction · 0.92

Calls 3

isFilenameFunction · 0.85
newKMSSignerFunction · 0.85
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…