PKCS8 key format

Source: Internet
Author: User
Tags openssl rsa

The following uses RSA 512

1. Generate a key pair

OpenSSL genrsa-out Rsa_pem.key 512


2.DER format

OpenSSL rsa-in rsa_pem.key-inform pem-out Rsa_der.key-outform der

---------------------------------------------------------------------

0000 30  13a:sequence {0004 02    1:   INTEGER 00007 02   41:   INTEGE r           :     9F F5 E3 C8 D3-C6 BC 0E DC D1 A2 7b           :     DA BC C1 1D A3 B5-EE E4 DB 16           :   & nbsp;  6D DF 3 A C3 AD A2 DD D7 5B 6C E6 A0 DF 86          &nb Sp :     E3 1 b F2 5A 8B AA F1 D8 CD af        & nbsp;  :     a9004a 02    3:   INTEGER 65537004F 02    40:   integer           :      0C C7 BF A9 F0 A0 2A1 a 2F 7E CE aa           :     2E B2 FF DD F4 4 a 6C 8D FB A3 6f           :     6B 4C E3 7A 9E A5 FA 8E BC 4 a 07           :      6C 5F 4D F8 B7 D9 B3 (DB DF) 010091 02   21:   integer    & nbsp;      :     D4-A3 E7 FD 7C 5E f0 & nbsp;         :     CE F9 2C E5 E8 7D 27 52 77 03 4F e3           :     2900B4 02    21:   integer           :      C0 D9 C4EB D1 F3 C6 F4 B5 4 b 54           :    & nbsp 1F BF C4 DD C4-CE 8E PNS D9 BD 78           :  & nbsp;   8100d7 02   20:   integer            :     2B 7C E3 8F D4 5B 1C F0 5A DB 8a            :     A0 D8 9B, F6 FE D7 d900f9 02&nbsp ;  20:   integer           :      A1 B6 4F 0B 9D D2 2F D2-6E/B6 E6 F6 40          &N Bsp :    -DA 1D F7 5D F7 0D F1 E3 01011B 02   21:   integer            :     B1, Eb C6, E2 eb BC, D2 1d   &nbsp ;       :    -E5 F9 C0 4D 5F 6D e1&nbsp ;          :     72            :  }


3.pkcs#8 format

OpenSSL pkcs8-topk8-in rsa_pem.key-inform pem-out pcks8_rsa.key-outform der-nocrypt

---------------------------------------------------------------------

0000 154:sequence {
0004 1:integer 0
0007 D:sequence {
0009 9:object IDENTIFIER rsaencryption (1 2 840 113549 1 1 1)
0014 0:null
:     }
0016 13e:octet STRING
: 3 A, 9F F5 E3 C8 D3 36
: C6 BC 0E DC D1 A2 7B DA BC C1 + 1D A3
: B5-EE E4 DB 6D DF 3 a C3 AD A2 DD
: D7 5B 6C E6 A0 DF 1 B F2 5A 95
: 8B AA F1 D8 CD, AF A9 02 03 01 00 01 02
: 0C C7 BF A9 F0 A0 2A 1 a 2F 7E CE
: AA 2E B2 FF DD F4 4 A/6C 8D FB A3
: 6F 6B 4C E3, 7A 9E A5 FA 8E BC 4 A
: [Another bytes skipped]
:   }



The following uses ECC 192

1. Generate a key pair

OpenSSL ecparam-name secp192r1-out Ec_key.pem-genkey


2.DER format

OpenSSL ec-in ec_key.pem-inform pem-out Ec_der.key-outform der

---------------------------------------------------------------------

0000 5f:sequence {
0002 1:integer 1
0005 18:octet STRING
: 1 A B6 FE F6 1E 1C C5 the BD 8B F0
: 7B 3B 0C 2F 80 BC
001F A0 A: [0] {
0021 8:object IDENTIFIER ' 1 2 840 10045 3 1 1 '
:     }
002B A1 34: [1] {
002D 32:bit STRING 0 Unused bits
: 6B BB F6 notoginseng E5 A8 E6 8F 6C be 8D B9
: AF ad B0 9F 5E BA 6F F3 AD 72 AC
: 5C 5A EC A3 (AB) AA 1 A 94 2E F8 5B 12
: 5B
:     }
:   }



3.pkcs#8 format

OpenSSL pkcs8-topk8-in ec_key.pem-inform pem-out pkcs8_ec.key-outform der-nocrypt


Der Goto PKCS8 format
OpenSSL pkcs8-topk8-in ec_der.key-inform der-out pkcs8_ec2.key-outform der-nocrypt

---------------------------------------------------------------------

0000 6f:sequence {
0002 1:integer 0
0005 13:sequence {
0007 7:object IDENTIFIER Ecpublickey (1 2 840 10045 2 1)
0010 8:object IDENTIFIER ' 1 2 840 10045 3 1 1 '
:     }
001A 55:octet STRING
: 1 A, B6 FE, F6 1E 1C
: C5 8B F0 7B 3B 0C 2F A1 BC
: 6B BB F6 notoginseng E5 A8 E6 8F
: 6C be 8D B9 AF AD B0 9F 5E BA 6F F3 20 29
: AD AC 5C 5A EC A3 1 A 94
: 2E F8 5B 5B
:   }











PKCS8 key format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.