use of com.google.crypto.tink.proto.Ed25519PublicKey in project tink by google.
the class Ed25519PublicKeyManagerTest method validateKey_wrongLength31_throws.
@Test
public void validateKey_wrongLength31_throws() throws Exception {
Ed25519PublicKey publicKey = signManager.getPublicKey(createPrivateKey());
Ed25519PublicKey invalidKey = Ed25519PublicKey.newBuilder(publicKey).setKeyValue(ByteString.copyFrom(Random.randBytes(31))).build();
assertThrows(GeneralSecurityException.class, () -> verifyManager.validateKey(invalidKey));
}
use of com.google.crypto.tink.proto.Ed25519PublicKey in project tink by google.
the class Ed25519PrivateKeyManagerTest method getPublicKey_checkValues.
/**
* Tests that a public key is extracted properly from a private key.
*/
@Test
public void getPublicKey_checkValues() throws Exception {
Ed25519PrivateKey privateKey = factory.createKey(Ed25519KeyFormat.getDefaultInstance());
Ed25519PublicKey publicKey = manager.getPublicKey(privateKey);
assertThat(publicKey).isEqualTo(privateKey.getPublicKey());
}
Aggregations