

# Decrypt クラス
<a name="aws-glue-api-pyspark-transforms-Decrypt"></a>

`Decrypt` 変換は AWS Glue 内で復号されます。AWS Encryption SDK を使用して、AWS Glue の外部でデータを復号することもできます。提供された KMS キー ARN が列の暗号化に使用されたものと一致しない場合、復号オペレーションは失敗します。

## 例
<a name="pyspark-Decrypt-examples"></a>

```
from pyspark.context import SparkContext
from pyspark.sql import SparkSession
from awsgluedi.transforms import *

kms = "${KMS}"
sc = SparkContext()
spark = SparkSession(sc)

input_df = spark.createDataFrame(
    [
        (1, "1234560000"),
        (2, "1234560001"),
        (3, "1234560002"),
        (4, "1234560003"),
        (5, "1234560004"),
        (6, "1234560005"),
        (7, "1234560006"),
        (8, "1234560007"),
        (9, "1234560008"),
        (10, "1234560009"),
    ],
    ["id", "phone"],
)

try:
    df_encrypt = pii.Encrypt.apply(
        data_frame=input_df,
        spark_context=sc,
        source_columns=["phone"],
        kms_key_arn=kms
    )
    df_decrypt = pii.Decrypt.apply(
        data_frame=df_encrypt,
        spark_context=sc,
        source_columns=["phone"],
        kms_key_arn=kms
    )
    df_decrypt.show()
except:
    print("Unexpected Error happened ")
    raise
```

## Output
<a name="pyspark-Decrypt-output"></a>

 出力は、元の「id」列と復号された「phone」列を持つ PySpark DataFrame になります。

```
```
+---+------------+
| id| phone|
+---+------------+
| 1| 1234560000|
| 2| 1234560001|
| 3| 1234560002|
| 4| 1234560003|
| 5| 1234560004|
| 6| 1234560005|
| 7| 1234560006|
| 8| 1234560007|
| 9| 1234560008|
| 10| 1234560009|
+---+------------+
```
```

 `Encrypt` 変換では、「source\$1columns」を「[phone]」として、「kms\$1key\$1arn」を「\$1\$1KMS\$1」環境変数の値として受け取ります。変換は、指定された KMS キーを使用して、「phone」列の値を暗号化します。次に、暗号化された DataFrame 「df\$1encrypt」が「awsglue.pii」モジュールからの `Decrypt` 変換に渡されます。「source\$1columns」を「[phone]」として、「kms\$1key\$1arn」を「\$1\$1KMS\$1」環境変数の値として扱います。変換は、同じ KMS キーを使用して、「phone」列の暗号化された値を復号します。結果の「df\$1decrypt」DataFrame には、元の「id」列と復号された「phone」列が含まれています。

## 方法
<a name="aws-glue-api-pyspark-transforms-Decrypt-_methods"></a>
+ [\$1\$1call\$1\$1](#aws-glue-api-pyspark-transforms-Decrypt-__call__)
+ [適用](#aws-glue-api-crawler-pyspark-transforms-Decrypt-apply)
+ [名前](#aws-glue-api-crawler-pyspark-transforms-Decrypt-name)
+ [describeArgs](#aws-glue-api-crawler-pyspark-transforms-Decrypt-describeArgs)
+ [describeReturn](#aws-glue-api-crawler-pyspark-transforms-Decrypt-describeReturn)
+ [describeTransform](#aws-glue-api-crawler-pyspark-transforms-Decrypt-describeTransform)
+ [describeErrors](#aws-glue-api-crawler-pyspark-transforms-Decrypt-describeErrors)
+ [説明](#aws-glue-api-crawler-pyspark-transforms-Decrypt-describe)

## \$1\$1call\$1\$1(spark\$1context、data\$1frame、source\$1columns、kms\$1key\$1arn)
<a name="aws-glue-api-pyspark-transforms-Decrypt-__call__"></a>

`Decrypt` 変換は Glue AWS 内で復号されます。AWS Encryption SDK を使用して、AWS Glue の外部でデータを復号することもできます。提供された KMS キー ARN が列の暗号化に使用されたものと一致しない場合、復号オペレーションは失敗します。
+ `source_columns` – 既存の列の配列。
+ `kms_key_arn` – ソース列の復号に使用する AWS Key Management Service キーのキー ARN。

## apply(cls, \$1args, \$1\$1kwargs)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-apply"></a>

継承元は `GlueTransform` [適用](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-apply)。

## name(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-name"></a>

継承元は `GlueTransform` [名前](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-name)。

## describeArgs(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-describeArgs"></a>

継承元は `GlueTransform` [describeArgs](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeArgs)。

## describeReturn(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-describeReturn"></a>

継承元は `GlueTransform` [describeReturn](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeReturn)。

## describeTransform(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-describeTransform"></a>

継承元は `GlueTransform` [describeTransform](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeTransform)。

## describeErrors(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-describeErrors"></a>

継承元は `GlueTransform` [describeErrors](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeErrors)。

## describe(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-Decrypt-describe"></a>

継承元は `GlueTransform` [説明](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describe)。