use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncGetKeyRing method asyncGetKeyRing.
public static void asyncGetKeyRing() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetKeyRingRequest request = GetKeyRingRequest.newBuilder().setName(KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString()).build();
ApiFuture<KeyRing> future = keyManagementServiceClient.getKeyRingCallable().futureCall(request);
// Do something.
KeyRing response = future.get();
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncGetLocation method syncGetLocation.
public static void syncGetLocation() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = keyManagementServiceClient.getLocation(request);
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class AsyncAsymmetricDecrypt method asyncAsymmetricDecrypt.
public static void asyncAsymmetricDecrypt() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
AsymmetricDecryptRequest request = AsymmetricDecryptRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).setCiphertext(ByteString.EMPTY).setCiphertextCrc32C(Int64Value.newBuilder().build()).build();
ApiFuture<AsymmetricDecryptResponse> future = keyManagementServiceClient.asymmetricDecryptCallable().futureCall(request);
// Do something.
AsymmetricDecryptResponse response = future.get();
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncAsymmetricDecrypt method syncAsymmetricDecrypt.
public static void syncAsymmetricDecrypt() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
AsymmetricDecryptRequest request = AsymmetricDecryptRequest.newBuilder().setName(CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString()).setCiphertext(ByteString.EMPTY).setCiphertextCrc32C(Int64Value.newBuilder().build()).build();
AsymmetricDecryptResponse response = keyManagementServiceClient.asymmetricDecrypt(request);
}
}
use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.
the class SyncAsymmetricSignStringDigest method syncAsymmetricSignStringDigest.
public static void syncAsymmetricSignStringDigest() throws Exception {
// It may require modifications to work in your environment.
try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
String name = CryptoKeyVersionName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]").toString();
Digest digest = Digest.newBuilder().build();
AsymmetricSignResponse response = keyManagementServiceClient.asymmetricSign(name, digest);
}
}
Aggregations