• 0
Sign in to follow this  
Guest carlosahsilva

duvida sobre DER e CertificationRequestInfo

Question

Guest carlosahsilva

Oi alguém sabe como fica um CertificationRequestInfo em DER antes de fazer o Hash?

CertificationRequestInfo ::= SEQUENCE {

version INTEGER { v1(0) } (v1,...),

subject Name,

subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},

attributes [0] Attributes{{ CRIAttributes }}

}

Digamos que fosse, os dados abaixo:

Version: 0 (0x0)

Subject:

countryName = US

stateOrProvinceName = New Hampshire

localityName = Nashua

organizationName = Compaq Computer Corp.

organizationalUnitName = OpenVMS Engineering

commonName = FLIP3.ZKO.DEC.COM

emailAddress = [email protected]

Subject Public Key Info:

Public Key Algorithm: rsaEncryption

RSA Public Key: (1024 bit)

Modulus (1024 bit):

00:d3:fc:bc:47:1b:84:fc:23:b2:9d:5a:5e:2b:4d:

06:82:f6:e0:15:6c:57:d6:8f:3d:50:b4:13:31:55:

12:c2:60:33:85:dc:db:8b:70:d9:2f:9b:3c:e5:84:

46:74:f5:60:61:6d:ab:5a:cd:6d:d9:24:20:8c:c4:

a5:15:3c:6d:6b:f0:b0:5b:a5:70:c2:7f:46:99:d6:

89:c2:4a:86:17:19:e9:c3:62:e6:ba:07:b1:2d:f8:

fe:e2:df:7b:01:9c:88:47:63:bb:80:9c:42:20:d4:

b9:09:68:37:b5:c9:f5:65:49:aa:b3:08:e4:ac:6f:

16:7a:15:0d:fb:60:ba:20:17

Exponent: 65537 (0x10001)

Attributes:

a0:00

Em BER ficaria

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

certificationRequestInfo CertificationRequestInfo,

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

CertificationRequestInfo ::= SEQUENCE {

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

[&H30] SEQUENCE

[&H82] Tamanho do tamanho 2 bytes

[&H01][&H66] Tamanho = 358

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

version INTEGER { v1(0) } (v1,...),

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

[&H02] INTERGER

[&H01] Tamanho = 1

[&H00] 0 ( V1(0) )

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

subject Name, (x509Name)

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

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

[&H30] SEQUENCE

[&H81] Tamanho do Tamanho 1

[&HBC] Tamanho = 188

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

countryName

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

[&H31] SET e SET OF

[&H0B] Tamanho = 11

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

[&H30] SEQUENCE

[&H09] Tamanho = 9

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

[&H06] OBJECT IDENTIFIER

[&H03] Tamanho = 3

U[&H04][&H06] OID countryName

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

[&H13] PrintableString

[&H02] Tamanho = 2

US

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

stateOrProvinceName

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

[&H31] SET e SET OF

[&H16] Tamanho = 22

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

[&H30] SEQUENCE

[&H14] Tamanho = 20

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

[&H06] OBJECT IDENTIFIER

[&H03] Tamanho = 3

U[&H04][&H08] OID: stateOrProvinceName

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

[&H13] PrintableString

[&H0D] Tamanho = 13

New Hampshire

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

localityName

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

[&H31] SET e SET OF

[&H0F] Tamanho = 15

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

[&H30] SEQUENCE

[&H0D] Tamanho = 13

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

[&H06] OBJECT IDENTIFIER

[&H03] Tamanho = 3

U[&H4][&H7] OID: localityName

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

[&H13] PrintableString

[&H06] Tamanho = 6

Nashua

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

organizationName

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

[&H31] SET e SET OF

[&H1E] Tamanho = 30

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

[&H30] SEQUENCE

[&H1C] Tamanho = 28

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

[&H06] OBJECT IDENTIFIER

[&H03] Tamanho = 3

U[&H04][&H0A] OID: organizationName

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

[&H13] PrintableString

[&H15] Tamanho = 21

Compaq Computer Corp.

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

organizationalUnitName

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

[&H31] SET e SET OF

[&H1C] Tamanho = 28

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

[0x30] SEQUENCE

[&H1A] Tamanho = 26

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

[&H06] OBJECT IDENTIFIER

[&H03] Tamanho = 3

U[&H04][&H0B] OID: organizationalUnitName

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

[&H13] PrintableString

[&H13] Tamanho = 19

OpenVMS Engineering

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

commonName

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

[&H31] SET e SET OF

[&H1A] Tamanho = 26

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

[&H30] SEQUENCE

[&H18] Tamanho = 24

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

[&H06] OBJECT IDENTIFIER

[&H03] Tamanho = 3

U[&H04][&H03] OID: commonName

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

[&H13] PrintableString

[&H11] Tamanho = 17

FLIP3.ZKO.DEC.COM

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

e-mailAddress

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

[&H31] SET e SET OF

[&H2A] Tamanho = 42

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

[&H30] SEQUENCE

[&H28] Tamanho = 40

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

[&H06] OBJECT IDENTIFIER

[&H09] Tamanho = 9

[&H2A][&H86][&H48][&H86][&HF7][&H0D][&H01][&H09][&H01] OID: e-mailAddress

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

[&H16] IA5String

[&H1B] Tamanho = 27

[email protected]

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

subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},

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

SubjectPublicKeyInfo { ALGORITHM : IOSet} ::= SEQUENCE {

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

[&H30] SEQUENCE

[&H81] Tamanho do Tamanho 1

[&H9F] Tamanho = 159

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

algorithm AlgorithmIdentifier {{IOSet}},

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

[&H30] SEQUENCE

[&H0D] Tamanho = 13

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

algorithm ALGORITHM.&id({IOSet}),

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

[&H06] OBJECT IDENTIFIER

[&H09] Tamanho = 9

[&H2A][&H86][&H48][&H86][&HF7][&H0D][&H01][&H01][&H01] OID: RSA Encryption

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

parameters ALGORITHM.&Type({IOSet}{@algorithm}) OPTIONAL

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

[&H05] NULL

[&H00] Tamanho 0

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

subjectPublicKey BIT STRING

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

[&H03] BIT STRING

[&H81] Tamanho do Tamanho 1

[&H8D] Tamanho = 141

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

[&H00] 0 = zero trailing bits

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

RSAPublicKey ::= SEQUENCE {

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

[&H30] SEQUENCE

[&H81] Tamanho do Tamanho=1

[&H89] Tamanho=137

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

modulus INTEGER, -- n --

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

[&H02] INTERGER

[&H81] Tamanho do Tamanho=1

[&H81] Tamanho=129

[&H00] 1ro byte maior que 7F, por isso coloca-se 0 a mais

[&HD3][&HFC][&HBC][&H47][&H1B][&H84][&HFC][&H23] Modulo Publico

[&HB2][&H9D][&H5A][&H5E][&H2B][&H4D][&H06][&H82] Modulo Publico

[&HF6][&HE0][&H15][&H6C][&H57][&HD6][&H8F][&H3D] Modulo Publico

[&H50][&HB4][&H13][&H31][&H55][&H12][&HC2][&H60] Modulo Publico

[&H33][&H85][&HDC][&HDB][&H8B][&H70][&HD9][&H2F] Modulo Publico

[&H9B][&H3C][&HE5][&H84][&H46][&H74][&HF5][&H60] Modulo Publico

[&H61][&H6D][&HAB][&H5A][&HCD][&H6D][&HD9][&H24] Modulo Publico

[&H20][&H8C][&HC4][&HA5][&H15][&H3C][&H6D][&H6B] Modulo Publico

[&HF0][&HB0][&H5B][&HA5][&H70][&HC2][&H7F][&H46] Modulo Publico

[&H99][&HD6][&H89][&HC2][&H4A][&H86][&H17][&H19] Modulo Publico

[&HE9][&HC3][&H62][&HE6][&HBA][&H07][&HB1][&H2D] Modulo Publico

[&HF8][&HFE][&HE2][&HDF][&H7B][&H01][&H9C][&H88] Modulo Publico

[&H47][&H63][&HBB][&H80][&H9C][&H42][&H20][&HD4] Modulo Publico

[&HB9][&H09][&H68][&H37][&HB5][&HC9][&HF5][&H65] Modulo Publico

[&H49][&HAA][&HB3][&H08][&HE4][&HAC][&H6F][&H16] Modulo Publico

[&H7A][&H15][&H0D][&HFB][&H60][&HBA][&H20][&H17] Modulo Publico

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

publicExponent INTEGER -- e --

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

[&H02] INTERGER

[&H03] Tamanho=3

[&H01][&H00][&H01] Expoente Publico

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

attributes [0] Attributes{{ CRIAttributes }}

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

[&HA0][&H00] Contexto Especifico A0 sem atributos opcionais

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

alguém sabe como ficaria em DER?

Grato desde já!!!

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this