use of com.google.crypto.tink.tinkkey.TinkKey in project tink by google.
the class KeysetManagerTest method addKeyHandle_unsupportedTinkKey_shouldThrow.
@Test
public void addKeyHandle_unsupportedTinkKey_shouldThrow() throws Exception {
TinkKey tinkKey = new TinkKey() {
@Override
public boolean hasSecret() {
return false;
}
@Override
public KeyTemplate getKeyTemplate() {
throw new UnsupportedOperationException();
}
};
KeyHandle keyHandle = KeyHandle.createFromKey(tinkKey, KeyAccess.publicAccess());
KeysetManager keysetManager = KeysetManager.withEmptyKeyset();
assertThrows(UnsupportedOperationException.class, () -> keysetManager.add(keyHandle));
}
use of com.google.crypto.tink.tinkkey.TinkKey in project tink by google.
the class KeysetManagerTest method addKeyHandleWithKeyAccess_unsupportedTinkKey_shouldThrow.
@Test
public void addKeyHandleWithKeyAccess_unsupportedTinkKey_shouldThrow() throws Exception {
TinkKey tinkKey = new TinkKey() {
@Override
public boolean hasSecret() {
return false;
}
@Override
public KeyTemplate getKeyTemplate() {
throw new UnsupportedOperationException();
}
};
KeyAccess keyAccess = KeyAccess.publicAccess();
KeyHandle keyHandle = KeyHandle.createFromKey(tinkKey, keyAccess);
KeysetManager keysetManager = KeysetManager.withEmptyKeyset();
assertThrows(UnsupportedOperationException.class, () -> keysetManager.add(keyHandle, keyAccess));
}
Aggregations