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

Function WithSignatureKey

internal/sshutil/agent.go:32–52  ·  view source on GitHub ↗

WithSignatureKey filters certificate not signed by the given signing keys.

(keys []ssh.PublicKey)

Source from the content-addressed store, hash-verified

30
31// WithSignatureKey filters certificate not signed by the given signing keys.
32func WithSignatureKey(keys []ssh.PublicKey) AgentOption {
33 signingKeys := make([][]byte, len(keys))
34 for i, k := range keys {
35 signingKeys[i] = k.Marshal()
36 }
37 return func(o *options) {
38 o.filterBySignatureKey = func(k *agent.Key) bool {
39 cert, err := ParseCertificate(k.Marshal())
40 if err != nil {
41 return false
42 }
43 b := cert.SignatureKey.Marshal()
44 for _, sb := range signingKeys {
45 if bytes.Equal(b, sb) {
46 return true
47 }
48 }
49 return false
50 }
51 }
52}
53
54// WithCertsOnly filters only those keys accompanied by a certificate.
55func WithCertsOnly() AgentOption {

Callers 4

doLoginIfNeededFunction · 0.92
loginActionFunction · 0.92
logoutActionFunction · 0.92
configActionFunction · 0.92

Calls 1

ParseCertificateFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…