• Home
  • About
    • lahuman photo

      lahuman

      열심히 사는 아저씨

    • Learn More
    • Facebook
    • LinkedIn
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

aws-crypto/clinet-node 버젼 문제

09 Oct 2022

Reading time ~2 minutes

aws-crypto/clinet-node 버젼 문제

2022년도 10월 18일 update

이슈를 해결 했다는 내용이 올라 왔습니다.

기존 처리 내용

데이터 암호화 처리의 키값 관리를 위해서 aws에서 제공하는 KMS를 이용해서 관리하려고 합니다. @aws-crypto/client-node를 이용하면 KMS의 키 값을 이용한 암/복호화 처리가 가능하다는 내용을 보고 테스트를 해보았습니다.

설치 후 오류를 만나다

모듈을 설치 후,

$ npm install @aws-crypto/client-node

aws/aws-encryption-sdk-javascript에서 제공하는 예제 코드를 실행하니 아래와 같은 오류를 만났습니다.

/* This builds the client with the REQUIRE_ENCRYPT_REQUIRE_DECRYPT commitment policy,
 * which enforces that this client only encrypts using committing algorithm suites
 * and enforces that this client
 * will only decrypt encrypted messages
 * that were created with a committing algorithm suite.
 * This is the default commitment policy
 * if you build the client with `buildClient()`.
 */
const { encrypt, decrypt } = buildClient(
  CommitmentPolicy.REQUIRE_ENCRYPT_REQUIRE_DECRYPT // 1.9.1 버젼에서는 REQUIRE_ENCRYPT_REQUIRE_DECRYPT enum 이 제공되지 않습니다. 
)
  • AWS Encryption SDK for JavaScript client for Node.js로 가서 버젼을 확인해보았습니다.

버젼이 이상하게 되어 있는 것을 확인하였습니다. 1.9.1이 현재 버젼이지만, 최신 버젼은 3.1.1이었습니다.

모듈 다시 설치

모듈의 버젼을 3.1.1으로 명시하여 설치 하고 동일하게 테스트 하면 정상 동작 합니다.

$ npm install @aws-crypto/client-node@3.1.1

github repository에 문의

코드를 제공해주는 곳에 이슈 @aws-crypto/client-node module version is wrong!를 제안하고 답변을 받았습니다.

Major version 1.x has reached end of support and only supports commitment policy FORBID_ENCRYPT_ALLOW_DECRYPT .

정책의 이유로 FORBID_ENCRYPT_ALLOW_DECRYPT만 제공한다고 되어 있습니다.

그럼 예제를 변경해줘야지란 생각을 했는데, 그냥 이슈를 닫아버렸네요.

AWS의 AWS Encryption SDK for JavaScript client for Node.js모듈을 사용할 계획을 가지고 계신다면, 3.1.1를 쓰거나 1.9.1을 사용한다면 옵션을 FORBID_ENCRYPT_ALLOW_DECRYPT으로 변경하여 사용해야 합니다. (3.1.1 + FORBID_ENCRYPT_ALLOW_DECRYPT 을 사용해도 정상 동작 합니다.)

추가로 1.9.1 + FORBID_ENCRYPT_ALLOW_DECRYPT으로 사용하면 아래와 같은 경고를 확인 할 수 있습니다.

This major version (1.x) of the AWS Encryption SDK for JavaScript has reached End-of-Support.
It will no longer receive security updates or bug fixes.
Consider updating to the latest version of the AWS Encryption SDK.

이럴꺼면, current version을 왜 1.9.1로 해두었는지 모르겠네요.

조만간 패치가 될 것으로 기대 합니다.

참고 자료

  • @aws-crypto/client-node module version is wrong!
  • AWS Encryption SDK for JavaScript client for Node.js
  • aws/aws-encryption-sdk-javascript


awscryptoclient Share Tweet +1