| _ "crypto/sha256" // Registrer SHA224 and SHA256 |
| _ "crypto/sha512" // Registrer SHA384 and SHA512 |
| type signatureAlgorithm struct { |
| func (h *signatureAlgorithm) HeaderParam() string { |
| func (h *signatureAlgorithm) HashID() crypto.Hash { |
| rs256 = &signatureAlgorithm{"RS256", crypto.SHA256} |
| rs384 = &signatureAlgorithm{"RS384", crypto.SHA384} |
| rs512 = &signatureAlgorithm{"RS512", crypto.SHA512} |
| es256 = &signatureAlgorithm{"ES256", crypto.SHA256} |
| es384 = &signatureAlgorithm{"ES384", crypto.SHA384} |
| es512 = &signatureAlgorithm{"ES512", crypto.SHA512} |
| func rsaSignatureAlgorithmByName(alg string) (*signatureAlgorithm, error) { |
| return nil, fmt.Errorf("RSA Digital Signature Algorithm %q not supported", alg) |
| func rsaPKCS1v15SignatureAlgorithmForHashID(hashID crypto.Hash) *signatureAlgorithm { |
| case hashID == crypto.SHA512: |
| case hashID == crypto.SHA384: |
| case hashID == crypto.SHA256: |