기본 콘텐츠로 건너뛰기

OpenSSL로 인증서 관리

인증서 생성

출처 : http://golmong.tistory.com/112

CA 인증서 생성

인증서 발급 기관 (CA : Certification Authority)에 해당하는 사설 키 및 인증서 발급 방법

- CA 개인키 생성 :  openssl genrsa -des3 -out ca.key 1024 
- Self-Signed CA 인증서 생성 :  openssl req -new -x509 -days 365 -key ca.key -out ca.crt 

demoCA 폴더 생성

CA가 하위 인증서를 생성 할 때마다 그 정보를 관리할 파일을 생성한다.

- demoCA 디렉토리 생성 : mkdir demoCA
- 시리얼 파일 생성 : demoCA/serial 파일을 생성하고 text로 00을 저장한다.
- index 파일 생성 :  demoCA/index.txt 란 이름의 빈 파일을 만든다.

하위 인증서 생성

하위 발급 기관 또는 최종 사용자의 인증서 생성

- server 개인키 생성 : openssl genrsa -des3 -out server.key 1024 
- server 인증서 발급을 위한 요청파일 생성 : openssl req -new -days 365 -key server.key -out server.csr
- server 인증서 발급 : openssl ca -in server.csr -out server.crt -keyfile ca.key -cert ca.crt -outdir .

위 작업의 결과로 server.crt 라는 server용인증서가 생성되고 index 파일에 발급내역이, serial이 16진수로 1씩 증가한다.


인증서 인코딩 포멧 변경

- openssl 이 생성하는 인증서의 인코딩은 발급 시 옵션을 주지 않으면 디폴트가 PEM (base64 encoding)이다.
- Java 등에서 사용하기 위한 DER 포맷(바이너리)으로 변경은 다음과 같이 수행한다.
   : openssl x509 -in ca.crt -out ca.der -outform DER


인증서 내용 보기

- openssl x509 -in ca.crt -text   (PEM 포맷인 경우)

- openssl x509 -in ca.der -inform DER -text (DER 포맷인 경우)

댓글

이 블로그의 인기 게시물

IntelliJ에 OpenJDK 와 OpenJFX 적용하기

환경 OS : Unbuntu 16.04 64bit jdk 설치 sudo apt-get install openjdk-8-jdk javafx 설치 sudo apt-get install openjfx 설치후 jdk를 보면 다음과 같이 openjfx(jfxrt.jar)가 link되어 있다. File->Project Structure -> SDK -> JDK home path -> 설치한 openjdk 위치 지정(/usr/lib/jvm/java-8-openjdk-amd64)

Intellij Artifacts 실행시 필요한 종속 library 추가.

개발 과정에서 build하여 run하면 잘 수행 되지만, artifact를 만들어서 실행하면 실행되지 않아 고생했다. 결국 찾은 방법이란 것이, 의존성을 갖고 있는 라이브러리가 함께 artifacts에 포함되지 않아서 발생한 문제였다. Intellij에서 라이브러리를 artifacts에 추가 하는 방법은, File -> Project Structure -> Artifacts -> Output Layout -> + -> Library Files -> 추가할 library 선택 이다. $ java -jar out/artifacts/JavaFXApp/JavaFXApp.jar 로 실행하면, 실행이 잘 된다.

원격에서 wireshark 사용하기

출처 : https://j2doll.github.io/wireshark-remote-command-win/README.ko.html ============================ linux pc 기반 ============================ # mkfifo /tmp/wireshark # wireshark -k -i /tmp/wireshark # ssh root@172.20.0.17 "/nand1/tcpdump -s 0 -U -w - -i eth0 not port 22" > /tmp/wireshark ============================ Window PC에서 packet capture ============================ 다음을 파일명  "remotecap.cmd"로 저장하여 command 창에서 실행 ** 환경변수 값은 상황에 맞게 변경 해야함. @REM ---------------------------------------------------- @REM remotecap.cmd @REM   Example command for captruing eremote network packet @REM  using wireshark and tcpdump. @REM   First written by j2doll. September 10th 2016. @REM   https://github.com/j2doll/wireshark-remote-command-win @REM   http://j2doll.tistory.com @REM ---------------------------------------------------- @REM install putty and wireshark on your windows pc. @SET PLINK_PATH="C:\Program Files\PuTTY\pli...