Search in sources :

Example 1 with PublicKeyTest

use of net.i2p.data.PublicKeyTest in project i2p.i2p by i2p.

the class RouterIdentityTest method testNullCert.

@Test
public void testNullCert() throws Exception {
    RouterIdentity ident = new RouterIdentity();
    ident.setCertificate(null);
    PublicKey pk = (PublicKey) (new PublicKeyTest()).createDataStructure();
    ident.setPublicKey(pk);
    SigningPublicKey k = (SigningPublicKey) (new SigningPublicKeyTest()).createDataStructure();
    ident.setSigningPublicKey(k);
    exception.expect(DataFormatException.class);
    exception.expectMessage("Not enough data to format the router identity");
    ident.writeBytes(new ByteArrayOutputStream());
}
Also used : SigningPublicKey(net.i2p.data.SigningPublicKey) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) SigningPublicKey(net.i2p.data.SigningPublicKey) PublicKey(net.i2p.data.PublicKey) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) StructureTest(net.i2p.data.StructureTest) CertificateTest(net.i2p.data.CertificateTest) Test(org.junit.Test) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest)

Example 2 with PublicKeyTest

use of net.i2p.data.PublicKeyTest in project i2p.i2p by i2p.

the class RouterIdentityTest method testNullSigningKey.

@Test
public void testNullSigningKey() throws Exception {
    RouterIdentity ident = new RouterIdentity();
    Certificate cert = (Certificate) (new CertificateTest()).createDataStructure();
    ident.setCertificate(cert);
    PublicKey pk = (PublicKey) (new PublicKeyTest()).createDataStructure();
    ident.setPublicKey(pk);
    ident.setSigningPublicKey(null);
    exception.expect(DataFormatException.class);
    exception.expectMessage("Not enough data to format the router identity");
    ident.writeBytes(new ByteArrayOutputStream());
}
Also used : SigningPublicKey(net.i2p.data.SigningPublicKey) PublicKey(net.i2p.data.PublicKey) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) CertificateTest(net.i2p.data.CertificateTest) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Certificate(net.i2p.data.Certificate) StructureTest(net.i2p.data.StructureTest) CertificateTest(net.i2p.data.CertificateTest) Test(org.junit.Test) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest)

Example 3 with PublicKeyTest

use of net.i2p.data.PublicKeyTest in project i2p.i2p by i2p.

the class RouterIdentityTest method createDataStructure.

public DataStructure createDataStructure() throws DataFormatException {
    RouterIdentity ident = new RouterIdentity();
    Certificate cert = (Certificate) (new CertificateTest()).createDataStructure();
    ident.setCertificate(cert);
    PublicKey pk = (PublicKey) (new PublicKeyTest()).createDataStructure();
    ident.setPublicKey(pk);
    SigningPublicKey k = (SigningPublicKey) (new SigningPublicKeyTest()).createDataStructure();
    ident.setSigningPublicKey(k);
    return ident;
}
Also used : SigningPublicKey(net.i2p.data.SigningPublicKey) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) SigningPublicKey(net.i2p.data.SigningPublicKey) PublicKey(net.i2p.data.PublicKey) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) CertificateTest(net.i2p.data.CertificateTest) Certificate(net.i2p.data.Certificate)

Example 4 with PublicKeyTest

use of net.i2p.data.PublicKeyTest in project i2p.i2p by i2p.

the class RouterIdentityTest method testCalculatedHash.

@Test
public void testCalculatedHash() throws Exception {
    RouterIdentity ident = new RouterIdentity();
    Certificate cert = (Certificate) (new CertificateTest()).createDataStructure();
    ident.setCertificate(cert);
    PublicKey pk = (PublicKey) (new PublicKeyTest()).createDataStructure();
    ident.setPublicKey(pk);
    SigningPublicKey k = (SigningPublicKey) (new SigningPublicKeyTest()).createDataStructure();
    ident.setSigningPublicKey(k);
    ident.calculateHash();
    ident.calculateHash();
    ident.calculateHash();
    ident.calculateHash();
    ident.calculateHash();
}
Also used : SigningPublicKey(net.i2p.data.SigningPublicKey) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) SigningPublicKey(net.i2p.data.SigningPublicKey) PublicKey(net.i2p.data.PublicKey) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest) CertificateTest(net.i2p.data.CertificateTest) Certificate(net.i2p.data.Certificate) StructureTest(net.i2p.data.StructureTest) CertificateTest(net.i2p.data.CertificateTest) Test(org.junit.Test) PublicKeyTest(net.i2p.data.PublicKeyTest) SigningPublicKeyTest(net.i2p.data.SigningPublicKeyTest)

Aggregations

CertificateTest (net.i2p.data.CertificateTest)4 PublicKey (net.i2p.data.PublicKey)4 PublicKeyTest (net.i2p.data.PublicKeyTest)4 SigningPublicKey (net.i2p.data.SigningPublicKey)4 SigningPublicKeyTest (net.i2p.data.SigningPublicKeyTest)4 Certificate (net.i2p.data.Certificate)3 StructureTest (net.i2p.data.StructureTest)3 Test (org.junit.Test)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2