forked from letsencrypt/boulder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linter_test.go
48 lines (41 loc) · 1.18 KB
/
linter_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package linter
import (
"crypto/ecdsa"
"crypto/ed25519"
"crypto/elliptic"
"crypto/rsa"
"math/big"
"testing"
"github.com/letsencrypt/boulder/test"
)
func TestMakeSigner_RSA(t *testing.T) {
rsaMod, ok := big.NewInt(0).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
test.Assert(t, ok, "failed to set RSA mod")
realSigner := &rsa.PrivateKey{
PublicKey: rsa.PublicKey{
N: rsaMod,
},
}
lintSigner, err := makeSigner(realSigner)
test.AssertNotError(t, err, "makeSigner failed")
_, ok = lintSigner.(*rsa.PrivateKey)
test.Assert(t, ok, "lint signer is not RSA")
}
func TestMakeSigner_ECDSA(t *testing.T) {
realSigner := &ecdsa.PrivateKey{
PublicKey: ecdsa.PublicKey{
Curve: elliptic.P256(),
},
}
lintSigner, err := makeSigner(realSigner)
test.AssertNotError(t, err, "makeSigner failed")
_, ok := lintSigner.(*ecdsa.PrivateKey)
test.Assert(t, ok, "lint signer is not ECDSA")
}
func TestMakeSigner_Unsupported(t *testing.T) {
realSigner := ed25519.NewKeyFromSeed([]byte("0123456789abcdef0123456789abcdef"))
_, err := makeSigner(realSigner)
test.AssertError(t, err, "makeSigner shouldn't have succeeded")
}
func TestMakeIssuer(t *testing.T) {
}