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

Function PublicKey

internal/cryptoutil/cryptoutil.go:52–70  ·  view source on GitHub ↗
(kmsURI, name string, opts ...pemutil.Options)

Source from the content-addressed store, hash-verified

50}
51
52func PublicKey(kmsURI, name string, opts ...pemutil.Options) (crypto.PublicKey, error) {
53 if isFilename(name) {
54 s, err := pemutil.Read(name, opts...)
55 if err != nil {
56 return nil, err
57 }
58 if pub, ok := s.(crypto.PublicKey); ok {
59 return pub, nil
60 }
61 return nil, fmt.Errorf("file %s does not contain a valid public key", name)
62 }
63
64 k, err := newKMSPublicKey(kmsURI, name)
65 if err != nil {
66 return nil, fmt.Errorf("failed to get public key: %w", err)
67 }
68
69 return k.Public(), nil
70}
71
72// CreateSigner reads a key from a file with a given name or creates a signer
73// with the given kms and name uri.

Callers 1

parseOrCreateKeyFunction · 0.92

Calls 4

isFilenameFunction · 0.85
newKMSPublicKeyFunction · 0.85
ReadMethod · 0.45
PublicMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…