package tls
import (
"crypto/ecdsa"
"crypto/ed25519"
"crypto/elliptic"
"crypto/rsa"
"crypto/x509"
)
var (
allowedSupportedVersionsFIPS = []uint16 {
VersionTLS12 ,
VersionTLS13 ,
}
allowedCurvePreferencesFIPS = []CurveID {
X25519MLKEM768 ,
CurveP256 ,
CurveP384 ,
CurveP521 ,
}
allowedSignatureAlgorithmsFIPS = []SignatureScheme {
PSSWithSHA256 ,
ECDSAWithP256AndSHA256 ,
Ed25519 ,
PSSWithSHA384 ,
PSSWithSHA512 ,
PKCS1WithSHA256 ,
PKCS1WithSHA384 ,
PKCS1WithSHA512 ,
ECDSAWithP384AndSHA384 ,
ECDSAWithP521AndSHA512 ,
}
allowedCipherSuitesFIPS = []uint16 {
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 ,
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 ,
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 ,
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 ,
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 ,
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 ,
}
allowedCipherSuitesTLS13FIPS = []uint16 {
TLS_AES_128_GCM_SHA256 ,
TLS_AES_256_GCM_SHA384 ,
}
)
func isCertificateAllowedFIPS(c *x509 .Certificate ) bool {
switch k := c .PublicKey .(type ) {
case *rsa .PublicKey :
return k .N .BitLen () >= 2048
case *ecdsa .PublicKey :
return k .Curve == elliptic .P256 () || k .Curve == elliptic .P384 () || k .Curve == elliptic .P521 ()
case ed25519 .PublicKey :
return true
default :
return false
}
}
The pages are generated with Golds v0.7.7-preview . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .