Search in sources :

Example 1 with GetPublicKeyRequest

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);
    }
}
Also used : GetPublicKeyRequest(com.google.cloud.kms.v1.GetPublicKeyRequest) PublicKey(com.google.cloud.kms.v1.PublicKey) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 2 with GetPublicKeyRequest

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();
    }
}
Also used : GetPublicKeyRequest(com.google.cloud.kms.v1.GetPublicKeyRequest) PublicKey(com.google.cloud.kms.v1.PublicKey) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

GetPublicKeyRequest (com.google.cloud.kms.v1.GetPublicKeyRequest)2 KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)2 PublicKey (com.google.cloud.kms.v1.PublicKey)2