(ctx *cli.Context)
| 208 | } |
| 209 | |
| 210 | func 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 | } |
no test coverage detected
searching dependent graphs…