

# Decrypt 클래스
<a name="aws-glue-api-pyspark-transforms-Decrypt"></a>

`Decrypt` 변환은 AWS Glue 내부에서 복호화를 수행합니다. AWS 암호화 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
```

## 출력
<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__)
+ [apply](#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)
+ [describe](#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` 변환은 AWS Glue 내부에서 복호화를 수행합니다. AWS 암호화 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` [apply](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` [name](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` [describe](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describe)에서 상속됩니다.