use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class DisableCustomerKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> \n\n" + "Where:\n" + " keyId - a key id value to disable (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
disableKey(kmsClient, keyId);
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class EncryptDataKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> \n\n" + "Where:\n" + " keyId - a key id value to use to encrypt/decrypt the data (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
SdkBytes encryData = encryptData(kmsClient, keyId);
decryptData(kmsClient, encryData, keyId);
System.out.println("Done");
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class ListGrants method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> \n\n" + "Where:\n" + " keyId - a key id value to use (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
displayGrantIds(kmsClient, keyId);
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class RevokeGrant method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> <grantId> \n\n" + "Where:\n" + " keyId - a unique identifier for the customer master key associated with the grant (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n" + " grantId - a grant id value of the grant revoke. \n\n";
if (args.length != 2) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
String grantId = args[1];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
revokeKeyGrant(kmsClient, keyId, grantId);
kmsClient.close();
}
use of software.amazon.awssdk.services.kms.KmsClient in project aws-doc-sdk-examples by awsdocs.
the class DescribeKey method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyId> \n\n" + "Where:\n" + " keyId - a key id value to describe (for example, xxxxxbcd-12ab-34cd-56ef-1234567890ab). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyId = args[0];
Region region = Region.US_WEST_2;
KmsClient kmsClient = KmsClient.builder().region(region).build();
describeSpecifcKey(kmsClient, keyId);
kmsClient.close();
}
Aggregations