use of com.google.cloud.kms.v1.GetPublicKeyRequest in project gapic-generator-java by googleapis.
the class SyncGetPublicKey method syncGetPublicKey.
public static void syncGetPublicKey() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetPublicKeyRequest request = GetPublicKeyRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
PublicKey response = keyManagementServiceClient.getPublicKey(request);
}
}
use of com.google.cloud.kms.v1.GetPublicKeyRequest in project gapic-generator-java by googleapis.
the class AsyncGetPublicKey method asyncGetPublicKey.
public static void asyncGetPublicKey() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetPublicKeyRequest request = GetPublicKeyRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).build();
ApiFuture<PublicKey> future = keyManagementServiceClient.getPublicKeyCallable().futureCall(request);
// Do something.
PublicKey response = future.get();
}
}
Aggregations