mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-01-14 02:20:06 +08:00
Ensure all tests pass without weak RSA key flag
This commit is contained in:
parent
f61804b905
commit
d50ea9bc1f
@ -17,7 +17,11 @@ func TestKeys(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func testKeyType(typ int, t *testing.T) {
|
func testKeyType(typ int, t *testing.T) {
|
||||||
sk, pk, err := test.RandTestKeyPair(typ, 512)
|
bits := 512
|
||||||
|
if typ == RSA {
|
||||||
|
bits = 2048
|
||||||
|
}
|
||||||
|
sk, pk, err := test.RandTestKeyPair(typ, bits)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -115,7 +119,7 @@ func testKeyEquals(t *testing.T, k Key) {
|
|||||||
// t.Fatal("Key not equal to key with same bytes.")
|
// t.Fatal("Key not equal to key with same bytes.")
|
||||||
// }
|
// }
|
||||||
|
|
||||||
sk, pk, err := test.RandTestKeyPair(RSA, 512)
|
sk, pk, err := test.RandTestKeyPair(RSA, 2048)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestRSABasicSignAndVerify(t *testing.T) {
|
func TestRSABasicSignAndVerify(t *testing.T) {
|
||||||
priv, pub, err := GenerateRSAKeyPair(512, rand.Reader)
|
priv, pub, err := GenerateRSAKeyPair(2048, rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ func TestRSASmallKey(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRSASignZero(t *testing.T) {
|
func TestRSASignZero(t *testing.T) {
|
||||||
priv, pub, err := GenerateRSAKeyPair(512, rand.Reader)
|
priv, pub, err := GenerateRSAKeyPair(2048, rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ func TestRSASignZero(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRSAMarshalLoop(t *testing.T) {
|
func TestRSAMarshalLoop(t *testing.T) {
|
||||||
priv, pub, err := GenerateRSAKeyPair(512, rand.Reader)
|
priv, pub, err := GenerateRSAKeyPair(2048, rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ type keyset struct {
|
|||||||
|
|
||||||
func (ks *keyset) generate() error {
|
func (ks *keyset) generate() error {
|
||||||
var err error
|
var err error
|
||||||
ks.sk, ks.pk, err = test.RandTestKeyPair(ic.RSA, 512)
|
ks.sk, ks.pk, err = test.RandTestKeyPair(ic.RSA, 2048)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -226,17 +226,31 @@ func TestValidate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hpkpMan = `QmRK3JgmVEGiewxWbhpXLJyjWuGuLeSTMTndA1coMHEy5o`
|
var hpkpMan = `QmcJeseojbPW9hSejUM1sQ1a2QmbrryPK4Z8pWbRUPaYEn`
|
||||||
var skManBytes = `
|
var skManBytes = `
|
||||||
CAAS4AQwggJcAgEAAoGBAL7w+Wc4VhZhCdM/+Hccg5Nrf4q9NXWwJylbSrXz/unFS24wyk6pEk0zi3W
|
CAASqAkwggSkAgEAAoIBAQC3hjPtPli71gFNzGJ6rUhYdb65BDwW7IrniEaZKi6z
|
||||||
7li+vSNVO+NtJQw9qGNAMtQKjVTP+3Vt/jfQRnQM3s6awojtjueEWuLYVt62z7mofOhCtj+VwIdZNBo
|
tW4Iz0MouEJY8GPG1iQfqZKp5w9H2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GYzhofWFhZk+EoaArHwWz2
|
||||||
|
tGrTrmsynBjt2wKBgErdYe+zZ2Wo+wXQGAoZi4pfcwiw4a97Kdh0dx+WZz7acHms
|
||||||
|
h+V20VRmEHm5h8WnJ/Wv5uK94t6NY17wzjQ7y2BN5mY5cA2cZAcpeqtv/N06tH4S
|
||||||
|
cn1UEuRB8VpwkjaPUNZhqtYK40qff2OTdJy8taFtQiN7fz9euWTC78zjph2s
|
||||||
`
|
`
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
// Run a set of sessions through the session setup and verification.
|
// Run a set of sessions through the session setup and verification.
|
||||||
func TestConnections(t *testing.T) {
|
func TestConnections(t *testing.T) {
|
||||||
clientTpt := newTestTransport(t, ci.RSA, 1024)
|
clientTpt := newTestTransport(t, ci.RSA, 2048)
|
||||||
serverTpt := newTestTransport(t, ci.Ed25519, 1024)
|
serverTpt := newTestTransport(t, ci.Ed25519, 1024)
|
||||||
|
|
||||||
testConnection(t, clientTpt, serverTpt)
|
testConnection(t, clientTpt, serverTpt)
|
||||||
|
Loading…
Reference in New Issue
Block a user