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());
}
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());
}
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;
}
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();
}
Aggregations