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

Function rsaHash

command/crypto/key/sign.go:210–241  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

208}
209
210func rsaHash(ctx *cli.Context) (crypto.SignerOpts, error) {
211 var h crypto.Hash
212 switch strings.ToLower(ctx.String("alg")) {
213 case "sha1":
214 h = crypto.SHA1
215 case "sha224":
216 h = crypto.SHA224
217 case "sha256", "":
218 h = crypto.SHA256
219 case "sha384":
220 h = crypto.SHA384
221 case "sha512":
222 h = crypto.SHA512
223 case "sha512-224":
224 h = crypto.SHA512_224
225 case "sha512-256":
226 h = crypto.SHA512_256
227 case "md5":
228 h = crypto.MD5
229 default:
230 return nil, errors.Errorf("unsupported algorithm %s", ctx.String("alg"))
231 }
232
233 if ctx.Bool("pss") {
234 return &rsa.PSSOptions{
235 SaltLength: rsa.PSSSaltLengthAuto,
236 Hash: h,
237 }, nil
238 }
239
240 return h, nil
241}

Callers 2

signActionFunction · 0.85
verifyActionFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…