github.com/minio/minio@v0.0.0-20240328213742-3f72439b8a27/internal/config/identity/openid/rsa-sha3_contrib.go (about) 1 // MinIO Object Storage (c) 2021 MinIO, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 //go:build !fips 16 // +build !fips 17 18 package openid 19 20 import ( 21 "crypto" 22 23 "github.com/golang-jwt/jwt/v4" 24 25 // Needed for SHA3 to work - See: https://golang.org/src/crypto/crypto.go?s=1034:1288 26 _ "golang.org/x/crypto/sha3" // There is no SHA-3 FIPS-140 2 compliant implementation 27 ) 28 29 // Specific instances for RS256 and company 30 var ( 31 SigningMethodRS3256 *jwt.SigningMethodRSA 32 SigningMethodRS3384 *jwt.SigningMethodRSA 33 SigningMethodRS3512 *jwt.SigningMethodRSA 34 ) 35 36 func init() { 37 // RS3256 38 SigningMethodRS3256 = &jwt.SigningMethodRSA{Name: "RS3256", Hash: crypto.SHA3_256} 39 jwt.RegisterSigningMethod(SigningMethodRS3256.Alg(), func() jwt.SigningMethod { 40 return SigningMethodRS3256 41 }) 42 43 // RS3384 44 SigningMethodRS3384 = &jwt.SigningMethodRSA{Name: "RS3384", Hash: crypto.SHA3_384} 45 jwt.RegisterSigningMethod(SigningMethodRS3384.Alg(), func() jwt.SigningMethod { 46 return SigningMethodRS3384 47 }) 48 49 // RS3512 50 SigningMethodRS3512 = &jwt.SigningMethodRSA{Name: "RS3512", Hash: crypto.SHA3_512} 51 jwt.RegisterSigningMethod(SigningMethodRS3512.Alg(), func() jwt.SigningMethod { 52 return SigningMethodRS3512 53 }) 54 }