分类: 网络与安全
2008-05-11 01:34:21
[weigw@TEST src]$ openssl genrsa -out privatekey.key 1024 Generating RSA private key, 1024 bit long modulus ....++++++ .......++++++ e is 65537 (0x10001) |
[weigw@TEST src]$ openssl genrsa -des3 -out privatekey.key 1024 Generating RSA private key, 1024 bit long modulus ............++++++ .....................++++++ e is 65537 (0x10001) Enter pass phrase for privatekey.key: Verifying - Enter pass phrase for privatekey.key: |
-des encrypt the generated key with DES in cbc mode -des3 encrypt the generated key with DES in ede cbc mode (168 bit key) -aes128, -aes192, -aes256 encrypt PEM output with cbc aes |
[weigw@TEST src]$ openssl rsa -in privatekey.key -out privatekey.key Enter pass phrase for privatekey.key: writing RSA key |
[weigw@TEST src]$ openssl req -new -x509 -key privatekey.key -out cacert.crt -days 1095 You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [GB]:CN State or Province Name (full name) [Berkshire]:beijing Locality Name (eg, city) [Newbury]:beijing Organization Name (eg, company) [My Company Ltd]:wondersoft Organizational Unit Name (eg, section) []:develop Common Name (eg, your name or your server's hostname) []:WeiGW Email Address []:weigongwan@sina.com |
[weigw@TEST src]$ openssl rsa -in privatekey.key -pubout -out pubkey.key writing RSA key |
[weigw@TEST src]$ openssl x509 -in cacert.crt -inform PEM -out cacert.der -outform DER [weigw@TEST src]$ |
[weigw@TEST src]$ openssl rsa -in privatekey.key -inform PEM -out privatekey.der -outform DER writing RSA key |
[weigw@TEST src]$ openssl rsa -pubin -in pubkey.key -inform PEM -pubout -out pubkey.der -outform DER writing RSA key |
[weigw@TEST bin]$ openssl genrsa -out server.key 1024 Generating RSA private key, 1024 bit long modulus .++++++ ..........................++++++ e is 65537 (0x10001) [weigw@TEST bin]$ openssl genrsa -out client.key 1024 Generating RSA private key, 1024 bit long modulus ...++++++ ....................................................++++++ e is 65537 (0x10001) [weigw@TEST bin]$ openssl genrsa -out ca.key 1024 Generating RSA private key, 1024 bit long modulus .............................................................++++++ .........++++++ e is 65537 (0x10001) [weigw@TEST bin]$ |
[weigw@TEST bin]$ openssl req -new -key server.key -out server.csr -days 1095 [weigw@TEST bin]$ openssl req -new -key client.key -out client.csr -days 1095 [weigw@TEST bin]$ openssl req -new -x509 -key ca.key -out ca.crt -days 1095 |
[weigw@TEST bin]$ openssl ca -in server.csr -out server.crt -cert ca.crt -keyfile ca.key [weigw@TEST bin]$ openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key |
[weigw@TEST bin]$ openssl ca -in client.csr -out client.crt -cert ca.crt -keyfile ca.key Using configuration from /usr/share/ssl/openssl.cnf I am unable to access the ./demoCA/newcerts directory ./demoCA/newcerts: No such file or directory [weigw@TEST bin]$ |
[weigw@TEST bin]$ cat client.crt client.key > client.pem [weigw@TEST bin]$ cat server.crt server.key > server.pem |
[weigw@TEST bin]$ openssl pkcs12 -export -clcerts -in client.crt -inkey client.key -out client.p12 Enter Export Password: Verifying - Enter Export Password: [weigw@TEST bin]$openssl pkcs12 -export -clcerts -in server.crt -inkey server.key -out server.p12 |
[weigw@TEST bin]$ openssl pkcs12 -in client.p12 -out client.txt Enter Import Password: MAC verified OK Enter PEM pass phrase: Verifying - Enter PEM pass phrase: [weigw@TEST bin]$openssl pkcs12 -in server.p12 -out server.txt Enter Import Password: MAC verified OK Enter PEM pass phrase: Verifying - Enter PEM pass phrase: |
[weigw@TEST bin]$ openssl x509 -in client.crt -noout -text -modulus [weigw@TEST bin]$ openssl rsa -in server.key -noout -text -modulus [weigw@TEST bin]$ openssl rsa -in server.pub -noout -text -modulus |
[weigw@TEST bin]$ openssl dhparam -out dh1024.pem 1024 |