| 1 |
From: Reinhard Tartler <[email protected]>, Simon Josefsson <[email protected]> |
| 2 |
Last-Updated: 2025-12-09 |
| 3 |
Subject: avoid-boulder |
| 4 |
Forwarded: not-needed |
| 5 |
|
| 6 |
Drop dependency on boulder, disable RSA checks |
| 7 |
|
| 8 |
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1122275 |
| 9 |
|
| 10 |
diff --git a/pkg/cryptoutils/goodkey/publickey.go b/pkg/cryptoutils/goodkey/publickey.go |
| 11 |
index 8c23157..a8240ac 100644 |
| 12 |
--- a/pkg/cryptoutils/goodkey/publickey.go |
| 13 |
+++ b/pkg/cryptoutils/goodkey/publickey.go |
| 14 |
@@ -17,57 +17,15 @@ |
| 15 |
package goodkey |
| 16 |
|
| 17 |
import ( |
| 18 |
- "context" |
| 19 |
"crypto" |
| 20 |
- "crypto/ecdsa" |
| 21 |
"crypto/ed25519" |
| 22 |
- "crypto/rsa" // nolint:gosec |
| 23 |
- "errors" |
| 24 |
"fmt" |
| 25 |
- |
| 26 |
- "github.com/letsencrypt/boulder/goodkey" |
| 27 |
) |
| 28 |
|
| 29 |
// ValidatePubKey validates the parameters of an RSA, ECDSA, or ED25519 public key. |
| 30 |
func ValidatePubKey(pub crypto.PublicKey) error { |
| 31 |
- // goodkey policy enforces: |
| 32 |
- // * RSA |
| 33 |
- // * Size of key: 2048 <= size <= 4096, size % 8 = 0 |
| 34 |
- // * Exponent E = 65537 (Default exponent for OpenSSL and Golang) |
| 35 |
- // * Small primes check for modulus |
| 36 |
- // * Weak keys generated by Infineon hardware (see https://crocs.fi.muni.cz/public/papers/rsa_ccs17) |
| 37 |
- // * Key is easily factored with Fermat's factorization method |
| 38 |
- // * EC |
| 39 |
- // * Public key Q is not the identity element (Ø) |
| 40 |
- // * Public key Q's x and y are within [0, p-1] |
| 41 |
- // * Public key Q is on the curve |
| 42 |
- // * Public key Q's order matches the subgroups (nQ = Ø) |
| 43 |
- allowedKeys := &goodkey.AllowedKeys{ |
| 44 |
- RSA2048: true, |
| 45 |
- RSA3072: true, |
| 46 |
- RSA4096: true, |
| 47 |
- ECDSAP256: true, |
| 48 |
- ECDSAP384: true, |
| 49 |
- ECDSAP521: true, |
| 50 |
- } |
| 51 |
- cfg := &goodkey.Config{ |
| 52 |
- FermatRounds: 100, |
| 53 |
- AllowedKeys: allowedKeys, |
| 54 |
- } |
| 55 |
- p, err := goodkey.NewPolicy(cfg, nil) |
| 56 |
- if err != nil { |
| 57 |
- // Should not occur, only chances to return errors are if fermat rounds |
| 58 |
- // are <0 or when loading blocked/weak keys from disk (not used here) |
| 59 |
- return errors.New("unable to initialize key policy") |
| 60 |
- } |
| 61 |
- |
| 62 |
+ // Avoid dependency on Goodkey for Debian |
| 63 |
switch pk := pub.(type) { |
| 64 |
- case *rsa.PublicKey: |
| 65 |
- // ctx is unused |
| 66 |
- return p.GoodKey(context.Background(), pub) |
| 67 |
- case *ecdsa.PublicKey: |
| 68 |
- // ctx is unused |
| 69 |
- return p.GoodKey(context.Background(), pub) |
| 70 |
case ed25519.PublicKey: |
| 71 |
return validateEd25519Key(pk) |
| 72 |
} |
| 73 |
diff --git a/pkg/cryptoutils/goodkey/publickey_test.go b/pkg/cryptoutils/goodkey/publickey_test.go |
| 74 |
index 7c992ae..d4dafc5 100644 |
| 75 |
--- a/pkg/cryptoutils/goodkey/publickey_test.go |
| 76 |
+++ b/pkg/cryptoutils/goodkey/publickey_test.go |
| 77 |
@@ -20,10 +20,7 @@ import ( |
| 78 |
"crypto/elliptic" |
| 79 |
"crypto/rand" |
| 80 |
"crypto/rsa" |
| 81 |
- "errors" |
| 82 |
"testing" |
| 83 |
- |
| 84 |
- "github.com/letsencrypt/boulder/goodkey" |
| 85 |
) |
| 86 |
|
| 87 |
func TestValidatePubKeyUnsupported(t *testing.T) { |
| 88 |
@@ -36,6 +33,8 @@ func TestValidatePubKeyUnsupported(t *testing.T) { |
| 89 |
} |
| 90 |
|
| 91 |
func TestValidatePubKeyRsa(t *testing.T) { |
| 92 |
+ t.Skip("Validations disabled for Debian") |
| 93 |
+ |
| 94 |
// Validate common RSA key sizes |
| 95 |
for _, bits := range []int{2048, 3072, 4096} { |
| 96 |
priv, err := rsa.GenerateKey(rand.Reader, bits) |
| 97 |
@@ -81,6 +80,7 @@ func (t testCurve) Params() *elliptic.CurveParams { |
| 98 |
} |
| 99 |
|
| 100 |
func TestValidatePubKeyEcdsa(t *testing.T) { |
| 101 |
+ t.Skip("Validations disabled for Debian") |
| 102 |
for _, curve := range []elliptic.Curve{elliptic.P256(), elliptic.P384(), elliptic.P521()} { |
| 103 |
priv, err := ecdsa.GenerateKey(curve, rand.Reader) |
| 104 |
if err != nil { |
| 105 |
@@ -96,20 +96,14 @@ func TestValidatePubKeyEcdsa(t *testing.T) { |
| 106 |
} |
| 107 |
} |
| 108 |
// Fails with smaller curve |
| 109 |
- priv, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) |
| 110 |
+ _, err := ecdsa.GenerateKey(elliptic.P224(), rand.Reader) |
| 111 |
if err != nil { |
| 112 |
t.Fatalf("ecdsa.GenerateKey failed: %v", err) |
| 113 |
} |
| 114 |
- if err := ValidatePubKey(priv.Public()); err == nil || !errors.Is(err, goodkey.ErrBadKey) { |
| 115 |
- t.Errorf("expected unsupported curve, got %v", err) |
| 116 |
- } |
| 117 |
// Fails with unknown curve |
| 118 |
err = ValidatePubKey(&ecdsa.PublicKey{ |
| 119 |
Curve: testCurve{}, |
| 120 |
}) |
| 121 |
- if err == nil || !errors.Is(err, goodkey.ErrBadKey) { |
| 122 |
- t.Errorf("expected unexpected curve, got %v", err) |
| 123 |
- } |
| 124 |
} |
| 125 |
|
| 126 |
func TestValidatePubKeyEd25519(t *testing.T) { |