1.Apache  download
2.Openssl.org/source download

./config --prefix=/usr/ssl --openssldir=/usr/ssl/openssl


./configure --prefix=/usr/local/apache2.2 --enable-so --enable-shared=max --enable-ssl


 [root@localhost key]# openssl sha1 * > rand.dat
[root@localhost key]# openssl genrsa -rand rand.dat -des3 1024 > key.pem
[root@localhost key]# openssl req -new -key key.pem > csr.pem

tradekorea
====================================================================================
keytool -genkey -keyalg rsa -sigalg "SHA1withRSA" -alias kait -keystore kait

keytool -certreq -alias kait -keyalg rsa -sigalg "SHA1withRSA" -file csr.txt -keystore kait

www.kait.or.kr

Tomcat
[root@localhost key]# keytool -genkey -keyalg rsa -alias cs -keystore keystore

[root@localhost key]# keytool -certreq -alias cs -keyalg rsa -file csr.txt -keystore keystore

[root@localhost key]# keytool -import  -keystore keystore -trustcacerts -file SecureCA-G2.pem  -alias Intermediate

[root@localhost key]# keytool -import  -keystore keystore -trustcacerts -file cert.txt -alias cs


common name
unit
organ
local
state
kr
====================================================================================
WebTOb

CA -newreq

wscfl ?i sample.m




1. 관련 파일을 지정된 디렉토리에 저장합니다.
- ssleay32.dll, libeay32.dll 파일은 C:?WINNT?system 에 copy합니다.
- mod_ssl.so 은 C:?Program Files?Apache Group?Apache2?modules 에 copy합니다.

3. Httpd.conf 파일 설정.
- LoadModule ssl_module modules/mod_ssl.so 의 주석 처리를 제거합니다.
- 아래와 같은 내용이 있는지 확인합니다. (없으면 타이핑하여 추가합니다)
<IfModule mod_ssl.c>
Include conf/ssl.conf
</IfModule>

4. ssl.conf 파일 설정
- Listen 443 을 주석 처리를 제거합니다.
SSLSessionCache none 을 주석 처리를 제거합니다.
SSLMutex none 을 주석 처리를 제거합니다.
<VirtualHost 192.168.xxx.xxx:443>
DocumentRoot “c:/my/webpages” ? 홈페이지 디렉토리
ServerName www.my-server.com:443 (or 192.168.xxx.xxx:443) ? URL 또는 IP
ServerAdmin my@email.com
ErrorLog logs/error_log
TransferLog logs/access_log
SSLEngine on
LogLevel info (없으면 타이핑하여 추가합니다)


아파치 재구동
- 2점대 $ apache ?D SSL (bin폴더 cmd에서 실행)
- 2.2점대 $ httpd ?D SSL
openssl rsa -in server.key.org -out server.key

openssl 설치

1. winnt/system32 디렉토리에 openssl.exe , ssleay32.dll , libeay32.dll 복사한다.
2. 도스창에서
  winnt/system32/regsvr32 libeay32.dll
  winnt/system32/regsvr32 ssleay32.dll (등록)
3. openssl 패스설정
  iis 4.0? 제어판 -> 시스템 -> 환경탭 -> path (openssl.exe 가 있는 디렉토리까지)
  iis 5.0? 제어판 -> 시스템 -> 고급 -> 환경변수 -> 시스템 변수
   - path (openssl.exe 가 있는 디렉토리까지)


Openssl 명령어

1. 아파치에서 키파일 패스워드 변경하는 방법.
 $ openssl rsa -des3 -in key.pem -out newkey.pem
 pass-phrase 를 물어보면...
 처음에는 기존 패스워드 입력, 두번째는 새로운 패스워드 입력.
 $ mv newkey.pem key.pem

2. 아파치에서 키파일 패스워드 삭제하는 방법
 $ openssl rsa -in key.pem -out newkey.pem

3. 아파치에서 키파일 삭제한 패스워드 복구하는 방법
 $ openssl rsa -in key.pem -des3 -out newkey.pem
 
4. 비밀키에 패스문(pass phrase) 설정하는 명령어
 $ openssl -in out filename.key(키파일) -des3 -out newfilename.key(패스문 없는 키파일)
        
5. pfx파일에서 키,인증서파일 추출하기
 $ pkcs12 -in filename.pfx -nocerts -out key.pem -> 키파일 추출
 $ pkcs12 -in filename.pfx -clcerts -nokeys -out cert.pem -> 인증서파일 추출



6. 키,인증서파일에서 .pfx파일로 변환하기
 $ pkcs12 -in cert.pem -inkey key.pem -export -out test.pfx

7. ?CSR 확인
 $ req -in filename(csr파일) -text

8. 인증서 확인
 $ x509 -in filename(인증서파일) -text -out outfilename(출력할 파일)

9. Global 인증서 쪼개서 보내기
 $ pkcs7 -in filename(인증서파일) -print_cert -out outfilename(출력할 파일)

10. 개인키와 공개키 보기
 $ rsa -in key.key -text

11. rsa 개인키 보여줌(pem 형식)
 $ rsa -in key.key -check

12. 모듈을 보여줌
 $ rsa -in key.key -modulus x509 -in cert.pem -modulus

13. text 형식을 pem 형식으로 바꾸기
 $ x509 -in filename.txt -out filename.pem

14, DER 형식을 pem 형식으로 바꾸기
 $ x509 -in cert.cer -inform DER -out cert.pem -outform PEM
 (참고로 웹로직을 사용하는 유닉스 환경에서는 이에 해당하는 명령어가..
 $ java utils.der2pem derFile명이다.
 (예, $java utils.der2pem designkey.der) east4620

15.pem 형식을 DER 형식으로 바꾸기
 $ x509 -in cert.pem -inform PEM -out cert.der -outform DER



* 인증서 finger.spc와 finger.pvk를 pfx형태로 변환합니다.
> pvkimprt -pfx finger.spc finger.pvk

* pfx형태로 변환된 파일을 openssl을 사용하여 pem으로 변환합니다.
> openssl pkcs12 -in finger.pfx -out finger.pem

* 변환된 pem파일을 pkcs형식의 keystore로 변환합니다.
> openssl pkcs12 -export -in finger.pem  -name finger -out finger.p12

* 변환한 p12형식의 인증서로 jarsigner를 통해 jar파일에 서명합니다.
> jarsigner -keystore finger.p12 -storepass finger21 -storetype pkcs12 SignedAppletDemo.jar finger

* 서명이 잘 되었는지 확인
> jarsigner -verify SignedAppletDemo.jar


-------------------------------------------------------
openssl pkcs12 -export -in 파일명(1번에서 합친 파일명) -name finger -out finger.p12



---------selt sign------
openssl req -new -x509 -nodes -out test.pem -keyout test.pem -days 365

1. Demo CA 설정
- 현재 디렉토리에 demoCA 디렉토리 생성 : mkdir demoCA
- demoCA 디렉토리 안에 시리얼 파일 생성 : serial 이란 이름의 text 파일에 00 을 적는다.
- index 파일 생성 :  index.txt 란 이름으로 빈 파일을 만든다.

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

3. 하위 인증서 생성 (예: HTTPS Web 서버용..)
- 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씩 증가한다.

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

5. 인증서 내용 보기
- openssl x509 -in ca.crt -text   (PEM 포맷인 경우)
- openssl x509 -in ca.der -inform DER -text (DER 포맷인 경우)


------------
Oracle

SSLWalletPassword password

opmnctl [verbose] stopproc ias-component=HTTP_Server
opmnctl [verbose] startproc ias-component=HTTP_Server

Posted by 으랏차
,