use of com.google.crypto.tink.tinkkey.internal.ProtoKey in project tink by google.
the class KeysetHandleTest method primaryKey_shouldWork.
@Test
public void primaryKey_shouldWork() throws Exception {
KeyTemplate kt1 = KeyTemplates.get("AES128_EAX");
KeyTemplate kt2 = KeyTemplates.get("HMAC_SHA256_256BITTAG");
KeysetHandle ksh = KeysetManager.withKeysetHandle(KeysetHandle.generateNew(kt1)).add(kt2).getKeysetHandle();
KeyHandle kh = ksh.primaryKey();
ProtoKey pk = (ProtoKey) kh.getKey(SecretKeyAccess.insecureSecretAccess());
assertThat(pk.getProtoKey().getTypeUrl()).isEqualTo(kt1.getTypeUrl());
}
Aggregations