Open noobdummy opened 3 years ago
# openssl asn1parse -help
Usage: asn1parse [options]
Valid options are:
-help Display this summary
-inform PEM|DER input format - one of DER PEM
-in infile input file
-out outfile output file (output format is always DER)
-i indents the output
-noout do not produce any output
-offset +int offset into file
-length +int length of section in file
-oid infile file of extra oid definitions
-dump unknown data in hex form
-dlimit +int dump the first arg bytes of unknown data in hex form
-strparse +int offset; a series of these can be used to 'dig'
into multiple ASN1 blob wrappings
-genstr val string to generate ASN1 structure from
-genconf val file to generate ASN1 structure from
(-inform will be ignored)
-strictpem do not attempt base64 decode outside PEM markers
-item val item to parse and print
# openssl genrsa -out private512.pem 512
Generating RSA private key, 512 bit long modulus (2 primes)
....+++++++++++++++++++++++++++
....+++++++++++++++++++++++++++
e is 65537 (0x010001)
# cat private512.pem
-----BEGIN RSA PRIVATE KEY-----
MIIBOgIBAAJBAK7fgV/nBzzGX5JO8JEImJraG+525MLarmDB+1OkC0Pv+mom+5Lq
i66ZZOYEfpYnCw5G/Z5KGf4g4vhRpSDAqX0CAwEAAQJAVX1wuxivohd8y4MJ+m1Q
ZYuxUgAPz+6mhyjuHDK7SydsVDVBf8IADNSC8zqjs5Ctoy3qARVfRmek4I3TdWgF
4QIhAOJhdLxqhuNgo7OOkaUnnp9lWa/f7kl0o1Nzy9RjxSj1AiEAxcDRtvaxoMFN
e8bma8mqsniAZycTdbzN+OxySX5BSWkCICb4g/ITnJjz//pfJq95vJLQDbp7IDhA
/gTVwFcVvdEpAiAyYpCMZ4qWhOnzEZh/+iAN3PoKTkB9DSAFvmjYJN0JkQIhAK2j
jObHmrG/NO+zd2aC4tysqQkNdRyTgrIbftcX58UF
-----END RSA PRIVATE KEY-----
# openssl asn1parse -dump -inform PEM -in private512.pem
0:d=0 hl=4 l= 314 cons: SEQUENCE
4:d=1 hl=2 l= 1 prim: INTEGER :00
7:d=1 hl=2 l= 65 prim: INTEGER :AEDF815FE7073CC65F924EF09108989ADA1BEE76E4C2DAAE60C1FB53A40B43EFFA6A26FB92EA8BAE9964E6047E96270B0E46FD9E4A19FE20E2F851A520C0A97D
74:d=1 hl=2 l= 3 prim: INTEGER :010001
79:d=1 hl=2 l= 64 prim: INTEGER :557D70BB18AFA2177CCB8309FA6D50658BB152000FCFEEA68728EE1C32BB4B276C5435417FC2000CD482F33AA3B390ADA32DEA01155F4667A4E08DD3756805E1
145:d=1 hl=2 l= 33 prim: INTEGER :E26174BC6A86E360A3B38E91A5279E9F6559AFDFEE4974A35373CBD463C528F5
180:d=1 hl=2 l= 33 prim: INTEGER :C5C0D1B6F6B1A0C14D7BC6E66BC9AAB2788067271375BCCDF8EC72497E414969
215:d=1 hl=2 l= 32 prim: INTEGER :26F883F2139C98F3FFFA5F26AF79BC92D00DBA7B203840FE04D5C05715BDD129
249:d=1 hl=2 l= 32 prim: INTEGER :3262908C678A9684E9F311987FFA200DDCFA0A4E407D0D2005BE68D824DD0991
283:d=1 hl=2 l= 33 prim: INTEGER :ADA38CE6C79AB1BF34EFB3776682E2DCACA9090D751C9382B21B7ED717E7C505
https://www.openssl.org/docs/manmaster/man1/openssl-asn1parse.html
# openssl asn1parse -genstr 'UTF8:Hello World'
0:d=0 hl=2 l= 11 prim: UTF8STRING :Hello World
# openssl asn1parse -genstr 'UTF8:Hello World' -noout -out utf8.der
# hexdump -C utf8.der
00000000 0c 0b 48 65 6c 6c 6f 20 57 6f 72 6c 64 |..Hello World|
0000000d
# cat asn1.cnf
asn1=SEQUENCE:seq_sect
[seq_sect]
field1=BOOL:TRUE
field2=EXP:0, UTF8:some random string
openssl asn1parse -genconf asn1.cnf -noout -out asn1.der
# hexdump -C asn1.der
00000000 30 19 01 01 ff a0 14 0c 12 73 6f 6d 65 20 72 61 |0........some ra|
00000010 6e 64 6f 6d 20 73 74 72 69 6e 67 |ndom string|
0000001b
# openssl prime -help
Usage: prime [options] [number...]
number Number to check for primality
-help Display this summary
-hex Hex output
-generate Generate a prime
-bits +int Size of number in bits
-safe When used with -generate, generate a safe prime
-checks +int Number of checks
https://www.openssl.org/docs/manmaster/man1/openssl-prime.html
# openssl prime -generate -bits 8
211
# openssl prime -generate -bits 8 -safe
227
# openssl prime -generate -bits 8 -safe -hex
E3
asn1parse
prime