Search in sources :

Example 11 with KeyManagementServiceClient

use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.

the class SyncCreateImportJobKeyringnameStringImportjob method syncCreateImportJobKeyringnameStringImportjob.

public static void syncCreateImportJobKeyringnameStringImportjob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        KeyRingName parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
        String importJobId = "importJobId1449444627";
        ImportJob importJob = ImportJob.newBuilder().build();
        ImportJob response = keyManagementServiceClient.createImportJob(parent, importJobId, importJob);
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) KeyRingName(com.google.cloud.kms.v1.KeyRingName) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 12 with KeyManagementServiceClient

use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.

the class SyncCreateImportJobStringStringImportjob method syncCreateImportJobStringStringImportjob.

public static void syncCreateImportJobStringStringImportjob() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        String parent = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]").toString();
        String importJobId = "importJobId1449444627";
        ImportJob importJob = ImportJob.newBuilder().build();
        ImportJob response = keyManagementServiceClient.createImportJob(parent, importJobId, importJob);
    }
}
Also used : ImportJob(com.google.cloud.kms.v1.ImportJob) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 13 with KeyManagementServiceClient

use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.

the class SyncCreateKeyRing method syncCreateKeyRing.

public static void syncCreateKeyRing() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder().setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()).setKeyRingId("keyRingId-2027180374").setKeyRing(KeyRing.newBuilder().build()).build();
        KeyRing response = keyManagementServiceClient.createKeyRing(request);
    }
}
Also used : KeyRing(com.google.cloud.kms.v1.KeyRing) CreateKeyRingRequest(com.google.cloud.kms.v1.CreateKeyRingRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 14 with KeyManagementServiceClient

use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.

the class SyncCreateKeyRingStringStringKeyring method syncCreateKeyRingStringStringKeyring.

public static void syncCreateKeyRingStringStringKeyring() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
        String keyRingId = "keyRingId-2027180374";
        KeyRing keyRing = KeyRing.newBuilder().build();
        KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing);
    }
}
Also used : KeyRing(com.google.cloud.kms.v1.KeyRing) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 15 with KeyManagementServiceClient

use of com.google.cloud.kms.v1.KeyManagementServiceClient in project gapic-generator-java by googleapis.

the class AsyncDecrypt method asyncDecrypt.

public static void asyncDecrypt() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        DecryptRequest request = DecryptRequest.newBuilder().setName(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).setCiphertext(ByteString.EMPTY).setAdditionalAuthenticatedData(ByteString.EMPTY).setCiphertextCrc32C(Int64Value.newBuilder().build()).setAdditionalAuthenticatedDataCrc32C(Int64Value.newBuilder().build()).build();
        ApiFuture<DecryptResponse> future = keyManagementServiceClient.decryptCallable().futureCall(request);
        // Do something.
        DecryptResponse response = future.get();
    }
}
Also used : DecryptResponse(com.google.cloud.kms.v1.DecryptResponse) DecryptRequest(com.google.cloud.kms.v1.DecryptRequest) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Aggregations

KeyManagementServiceClient (com.google.cloud.kms.v1.KeyManagementServiceClient)185 CryptoKey (com.google.cloud.kms.v1.CryptoKey)56 CryptoKeyVersion (com.google.cloud.kms.v1.CryptoKeyVersion)39 CryptoKeyVersionName (com.google.cloud.kms.v1.CryptoKeyVersionName)37 CryptoKeyName (com.google.cloud.kms.v1.CryptoKeyName)33 ByteString (com.google.protobuf.ByteString)20 KeyRingName (com.google.cloud.kms.v1.KeyRingName)17 KeyRing (com.google.cloud.kms.v1.KeyRing)16 FieldMask (com.google.protobuf.FieldMask)16 PublicKey (com.google.cloud.kms.v1.PublicKey)14 ImportJob (com.google.cloud.kms.v1.ImportJob)10 Test (org.junit.Test)10 Digest (com.google.cloud.kms.v1.Digest)8 EncryptResponse (com.google.cloud.kms.v1.EncryptResponse)8 Policy (com.google.iam.v1.Policy)8 X509EncodedKeySpec (java.security.spec.X509EncodedKeySpec)8 DecryptResponse (com.google.cloud.kms.v1.DecryptResponse)7 AsymmetricDecryptResponse (com.google.cloud.kms.v1.AsymmetricDecryptResponse)6 AsymmetricSignResponse (com.google.cloud.kms.v1.AsymmetricSignResponse)6 LocationName (com.google.cloud.kms.v1.LocationName)6