...
1
2
3
4
5
6
7 package x509
8
9 import (
10 "crypto/ecdsa"
11 "crypto/elliptic"
12 "crypto/internal/boring/fipstls"
13 "crypto/rsa"
14 )
15
16
17
18
19 func boringAllowCert(c *Certificate) bool {
20 if !fipstls.Required() {
21 return true
22 }
23
24
25
26 switch k := c.PublicKey.(type) {
27 default:
28 return false
29 case *rsa.PublicKey:
30 if size := k.N.BitLen(); size != 2048 && size != 3072 && size != 4096 {
31 return false
32 }
33 case *ecdsa.PublicKey:
34 if k.Curve != elliptic.P256() && k.Curve != elliptic.P384() && k.Curve != elliptic.P521() {
35 return false
36 }
37 }
38 return true
39 }
40
View as plain text