I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9af197e5 authored by str4d's avatar str4d
Browse files

Add KeyCert test that fails

parent 2f59a4b3
No related branches found
No related tags found
No related merge requests found
package net.i2p.data;
/*
* free (adj.): unencumbered; not under the control of others
* Written by str4d in 2015 and released into the public domain
* with no warranty of any kind, either expressed or implied.
* It probably won't make your computer catch on fire, or eat
* your children, but it might. Use at your own risk.
*
*/
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import net.i2p.crypto.EncType;
import net.i2p.crypto.SigType;
import junit.framework.TestCase;
/**
* @author str4d
*/
public class KeyCertificateTest extends TestCase {
private static final byte[] P256_PAYLOAD = new byte[] {
0, (byte) (SigType.ECDSA_SHA256_P256.getCode()),
0, (byte) (EncType.EC_P256.getCode())
};
private static final byte[] P521_PAYLOAD = new byte[] {
0, (byte) (SigType.ECDSA_SHA512_P521.getCode()),
0, (byte) (EncType.ELGAMAL_2048.getCode()),
0, 0, 0, 0
};
public void testFromP256Payload() throws DataFormatException {
KeyCertificate cert = new KeyCertificate(P256_PAYLOAD);
assertThat(cert.getSigTypeCode(), is(equalTo(SigType.ECDSA_SHA256_P256.getCode())));
assertThat(cert.getCryptoTypeCode(), is(equalTo(EncType.EC_P256.getCode())));
assertThat(cert.getExtraSigningKeyData(), is(nullValue()));
}
public void testFromEd25519Payload() throws DataFormatException {
KeyCertificate cert = new KeyCertificate(P521_PAYLOAD);
assertThat(cert.getSigTypeCode(), is(equalTo(SigType.ECDSA_SHA512_P521.getCode())));
assertThat(cert.getCryptoTypeCode(), is(equalTo(EncType.ELGAMAL_2048.getCode())));
assertThat(cert.getExtraSigningKeyData().length, is(4));
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment