Search in sources :

Example 21 with KeyManagementServiceClient

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

the class SyncCreateCryptoKeyStringStringCryptokey method syncCreateCryptoKeyStringStringCryptokey.

public static void syncCreateCryptoKeyStringStringCryptokey() 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 cryptoKeyId = "cryptoKeyId-1643185255";
        CryptoKey cryptoKey = CryptoKey.newBuilder().build();
        CryptoKey response = keyManagementServiceClient.createCryptoKey(parent, cryptoKeyId, cryptoKey);
    }
}
Also used : CryptoKey(com.google.cloud.kms.v1.CryptoKey) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 22 with KeyManagementServiceClient

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

the class SyncCreateCryptoKeyVersionStringCryptokeyversion method syncCreateCryptoKeyVersionStringCryptokeyversion.

public static void syncCreateCryptoKeyVersionStringCryptokeyversion() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        String parent = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
        CryptoKeyVersion cryptoKeyVersion = CryptoKeyVersion.newBuilder().build();
        CryptoKeyVersion response = keyManagementServiceClient.createCryptoKeyVersion(parent, cryptoKeyVersion);
    }
}
Also used : CryptoKeyVersion(com.google.cloud.kms.v1.CryptoKeyVersion) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 23 with KeyManagementServiceClient

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

the class SyncGetCryptoKey method syncGetCryptoKey.

public static void syncGetCryptoKey() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        GetCryptoKeyRequest request = GetCryptoKeyRequest.newBuilder().setName(CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString()).build();
        CryptoKey response = keyManagementServiceClient.getCryptoKey(request);
    }
}
Also used : GetCryptoKeyRequest(com.google.cloud.kms.v1.GetCryptoKeyRequest) CryptoKey(com.google.cloud.kms.v1.CryptoKey) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 24 with KeyManagementServiceClient

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

the class SyncGetCryptoKeyCryptokeyname method syncGetCryptoKeyCryptokeyname.

public static void syncGetCryptoKeyCryptokeyname() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        CryptoKeyName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
        CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
    }
}
Also used : CryptoKeyName(com.google.cloud.kms.v1.CryptoKeyName) CryptoKey(com.google.cloud.kms.v1.CryptoKey) KeyManagementServiceClient(com.google.cloud.kms.v1.KeyManagementServiceClient)

Example 25 with KeyManagementServiceClient

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

the class SyncGetCryptoKeyString method syncGetCryptoKeyString.

public static void syncGetCryptoKeyString() throws Exception {
    // It may require modifications to work in your environment.
    try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
        String name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]").toString();
        CryptoKey response = keyManagementServiceClient.getCryptoKey(name);
    }
}
Also used : CryptoKey(com.google.cloud.kms.v1.CryptoKey) 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