티스토리 뷰

PKCS#12, 인증서, 개인키 파일 분리하기.


APNS적용을 위해  인증서를 설치하던중 PKCS#12 형태의 파일을 받았습니다.

PKCS#12란  하나의 파일로 여러 암호 객체를 저장하기위한 보관 파일 형식을 정의합니다.  일반적으로 X.509 인증서, 개인 키를 bundle로 관리하는 방식입니다. [ 출처 :http://en.wikipedia.org/wiki/PKCS_%E2%99%AF12 ]


openssl 도구를 이용하여 인증서와 키파일을 분리.

개인키 파일 분리

# openssl pkcs12 -in pushTestCertificate.p12 -nocerts -out private.pem

인증서 파일 분리

# openssl pkcs12 -in pushTestCertificate.p12 -clcerts -nokeys -out cert.pem


[참고 URL : http://stackoverflow.com/questions/9497719/how-to-extract-a-public-private-key-from-a-pkcs12-file-with-openssl-for-later-us]


PKCS 규격에관한 WIKI 자료

약어버전이름설명
PKCS #12.1RSA 암호 표준(RSA Cryptography Standard)RFC 3447에 기술되어 있다. RSA의 공개 키와 비밀 키(ASN.1 으로 인코딩됨)에 대한 수학적 성질과 규격에 대해 정의하고 있으며, 또한 RSA 암호화와 복호화, 서명 검증을 구현하는 데에 필요한 알고리즘과 인코딩/패딩 등의 규격을 정의하고 있다.
PKCS #2-(철회됨)현재는 사용하지 않는다. 메시지 다이제스트를 RSA 암호화하는 부분을 다루고 있었으며, 해당 내용은 PKCS #1으로 합쳐졌다.
PKCS #31.4디피-헬만 키 교환 표준(Diffie-Hellman Key-Agreement Standard)디피-헬만 키 교환 방법을 이용한 통신에 대해 정의하고 있다.
PKCS #4-(철회됨)현재는 사용하지 않는다. RSA 키를 표현하는 규격을 다루고 있었으며, PKCS #1으로 합쳐졌다.
PKCS #52.0비밀번호 기반 암호화 표준(Password-based Encryption Standard)비밀번호에 기반한 암호 시스템을 구현할 때 고려해야 할 점을 설명하고 있다. RFC 2898에 기술되어 있다.
PKCS #61.5인증서 확장 문법 표준(Extended-Certificate Syntax Standard)X.509 인증서 규격의 v1을 확장했다. 현재는 X.509 v3가 있어 사용되지 않는다.
PKCS #71.5암호 메시지 문법 표준(Cryptographic Message Syntax Standard)RFC 2315에 기술되어 있다. 암호화한 데이터를 표현하는 방식에 대한 표준이다.
PKCS #81.2개인키 정보 문법 표준(Private-Key Information Syntax Standard)RFC 5208에 기술되어 있다. 공개키 암호에서 사용되는 비밀키 값에 대한 문법을 정의한다.
PKCS #92.0Selected Attribute Types다른 PKCS에서 사용하는 속성값들에 대하여 정의한다.
PKCS #101.7인증서 요청 표준(Certification Request Standard)RFC 2986에 기술되어 있다. 인증 기관에 인증서를 요청할 때 사용하는 프로토콜을 정의한다.
PKCS #112.20암호 토큰 인터페이스(Cryptographic Token Interface)[1]Cryptoki로도 알려져있다. 암호 토큰(Hardware Security Module 참고)에 대한 범용 인터페이스를 정의하는 API이다. 주로 Single Sign-On공개 키 암호 방식디스크 암호화[2] 시스템에 사용한다.
PKCS #121.0Personal Information Exchange Syntax StandardDefines a file format commonly used to store private keys with accompanying public key certificates, protected with a password-based symmetric key. PFX is a predecessor to PKCS#12.

This container format can contain multiple embedded objects, e.g. multiple certificates. Usually protected/encrypted with a password. Can be used as a format for the Java key store. Usable by Tomcat, but NOT by Apache.

PKCS #13타원 곡선 암호 표준(Elliptic Curve Cryptography Standard)(개발중)
PKCS #14유사난수 생성기(Pseudo-random Number Generation)(개발중)
PKCS #151.1Cryptographic Token Information Format StandardDefines a standard allowing users of cryptographic tokens to identify themselves to applications, independent of the application's Cryptoki implementation (PKCS #11) or other API. RSA has relinquished IC-card-related parts of this standard to ISO/IEC 7816-15 [3].

[출처 : http://ko.wikipedia.org/wiki/%EA%B3%B5%EA%B0%9C_%ED%82%A4_%EC%95%94%ED%98%B8_%ED%91%9C%EC%A4%80 ]


이상 간단한 포스팅을 마치도록 하겠습니다.

.by rocksea

댓글