お客様の入力を暗号化する - Amazon Connect

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

お客様の入力を暗号化する

フローによって収集された機密データを暗号化できます。これを行うには、パブリックキー暗号を使用する必要があります。

Amazon Connect を設定するときは、まずパブリックキーを指定します。これは、データを暗号化するときに使用されるキーです。後で、X.509 証明書を指定します。この証明書には、プライベートキーを所有していることを証明する署名が含まれています。

データを収集するフローでは、[Stored customer input] (保存済みの顧客の入力) 属性を使用してキャプチャーされたデータを暗号化するための X.509 証明書を提供します。この機能を使用するには、キーを .pem 形式でアップロードする必要があります。暗号化キーを使用して、フロー内で使用される証明書の署名を確認します。

注記

ローテーションのために、最大 2 つの暗号化キーを同時にアクティブにできます。

Stored Customer Input 属性のデータを復号するには、 AWS Encryption を使用しますSDK。詳細については、AWS Encryption SDK デベロッパーガイドを参照してください。

Amazon Connect によって暗号化されたデータを復号化する方法

次のコードサンプルは、 AWS 暗号化 を使用してデータを復号する方法を示していますSDK。

package com.amazonaws; import com.amazonaws.encryptionsdk.AwsCrypto; import com.amazonaws.encryptionsdk.CryptoResult; import com.amazonaws.encryptionsdk.jce.JceMasterKey; import org.bouncycastle.jce.provider.BouncyCastleProvider; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.security.GeneralSecurityException; import java.security.KeyFactory; import java.security.Security; import java.security.interfaces.RSAPrivateKey; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Base64; public class AmazonConnectDecryptionSample { // The Provider 'AmazonConnect' is used during encryption, this must be used during decryption for key // to be found private static final String PROVIDER = "AmazonConnect"; // The wrapping algorithm used during encryption private static final String WRAPPING_ALGORITHM = "RSA/ECB/OAEPWithSHA-512AndMGF1Padding"; /** * This sample show how to decrypt data encrypted by Amazon Connect. * To use, provide the following command line arguments: [path-to-private-key] [key-id] [cyphertext] * Where: * path-to-private-key is a file containing the PEM encoded private key to use for decryption * key-id is the key-id specified during encryption in your flow * cyphertext is the result of the encryption operation from Amazon Connect */ public static void main(String[] args) throws IOException, GeneralSecurityException { String privateKeyFile = args[0]; // path to PEM encoded private key to use for decryption String keyId = args[1]; // this is the id used for key in your flow String cypherText = args[2]; // the result from flow Security.addProvider(new BouncyCastleProvider()); // read the private key from file String privateKeyPem = new String(Files.readAllBytes(Paths.get(privateKeyFile)), Charset.forName("UTF-8")); RSAPrivateKey privateKey = getPrivateKey(privateKeyPem); AwsCrypto awsCrypto = new AwsCrypto(); JceMasterKey decMasterKey = JceMasterKey.getInstance(null,privateKey, PROVIDER, keyId, WRAPPING_ALGORITHM); CryptoResult<String, JceMasterKey> result = awsCrypto.decryptString(decMasterKey, cypherText); System.out.println("Decrypted: " + result.getResult()); } public static RSAPrivateKey getPrivateKey(String privateKeyPem) throws IOException, GeneralSecurityException { String privateKeyBase64 = privateKeyPem .replace("-----BEGIN RSA PRIVATE KEY-----\n", "") .replace("-----END RSA PRIVATE KEY-----", "") .replaceAll("\n", ""); byte[] decoded = Base64.getDecoder().decode(privateKeyBase64); KeyFactory kf = KeyFactory.getInstance("RSA"); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decoded); RSAPrivateKey privKey = (RSAPrivateKey) kf.generatePrivate(keySpec); return privKey; } }