Imported Upstream version 1.2.2-1
[packages/binwalk.git] / magic / crypto
1 # Type: OpenSSL certificates/key files
2 # From: Nicolas Collignon <tsointsoin@gmail.com>
3
4 0       string  -----BEGIN\x20CERTIFICATE-----      PEM certificate
5 0       string  -----BEGIN\x20CERTIFICATE\x20REQ    PEM certificate request
6 0       string  -----BEGIN\x20RSA\x20PRIVATE        PEM RSA private key
7 0       string  -----BEGIN\x20DSA\x20PRIVATE        PEM DSA private key
8
9 # Type: OpenSSH key files
10 # From: Nicolas Collignon <tsointsoin@gmail.com>
11
12 0       string  SSH\x20PRIVATE\x20KEY   OpenSSH RSA1 private key,
13 >28     string  >\0                     version "%s"
14
15 0       string  ssh-dss\x20               OpenSSH DSA public key
16 0       string  ssh-rsa\x20               OpenSSH RSA public key
17
18 # Type: Certificates/key files in DER format
19 # From: Gert Hulselmans <hulselmansgert@gmail.com>
20 0       string  \x30\x82                Private key in DER format (PKCS#8),
21 >4      string  !\x02\x01\x00           invalid,
22 >>2     beshort x                       header length: 4, sequence length: %d
23
24 0       string  \x30\x82                Certificate in DER format (x509 v3),
25 >4      string  !\x30\x82               invalid,
26 >>2     beshort x                       header length: 4, sequence length: %d
27
28 # GnuPG
29 # The format is very similar to pgp
30 0       string          \001gpg                 GPG key trust database
31 >4      byte            x                       version %d
32
33 # Not a very useful signature
34 #0       beshort         0x9901                  GPG key public ring
35
36 # This magic is not particularly good, as the keyrings don't have true
37 # magic. Nevertheless, it covers many keyrings.
38
39 #------------------------------------------------------------------------------
40 # Mavroyanopoulos Nikos <nmav@hellug.gr>
41 # mcrypt:   file(1) magic for mcrypt 2.2.x;
42 0       string          \0m\3           mcrypt 2.5 encrypted data,
43 >4      byte            0               invalid
44 >4      string          >\0             algorithm: "%s",
45 >>&1    leshort         <1              invalid
46 >>&1    leshort         >0              keysize: %d bytes,
47 >>>&0   byte            0               invalid
48 >>>&0   string          >\0             mode: "%s",
49
50 0       string          \0m\2           mcrypt 2.2 encrypted data,
51 >3      byte            0               algorithm: blowfish-448,
52 >3      byte            1               algorithm: DES,
53 >3      byte            2               algorithm: 3DES,
54 >3      byte            3               algorithm: 3-WAY,
55 >3      byte            4               algorithm: GOST,
56 >3      byte            6               algorithm: SAFER-SK64,
57 >3      byte            7               algorithm: SAFER-SK128,
58 >3      byte            8               algorithm: CAST-128,
59 >3      byte            9               algorithm: xTEA,
60 >3      byte            10              algorithm: TWOFISH-128,
61 >3      byte            11              algorithm: RC2,
62 >3      byte            12              algorithm: TWOFISH-192,
63 >3      byte            13              algorithm: TWOFISH-256,
64 >3      byte            14              algorithm: blowfish-128,
65 >3      byte            15              algorithm: blowfish-192,
66 >3      byte            16              algorithm: blowfish-256,
67 >3      byte            100             algorithm: RC6,
68 >3      byte            101             algorithm: IDEA,
69 >3      byte            <0              invalid algorithm
70 >3      byte            >101            invalid algorithm,
71 >3      byte            >16
72 >>3     byte            <100            invalid algorithm,
73 >4      byte            0               mode: CBC,
74 >4      byte            1               mode: ECB,
75 >4      byte            2               mode: CFB,
76 >4      byte            3               mode: OFB,
77 >4      byte            4               mode: nOFB,
78 >4      byte            <0              invalid mode,
79 >4      byte            >4              invalid mode,
80 >5      byte            0               keymode: 8bit
81 >5      byte            1               keymode: 4bit
82 >5      byte            2               keymode: SHA-1 hash
83 >5      byte            3               keymode: MD5 hash
84 >5      byte            <0              invalid keymode
85 >5      byte            >3              invalid keymode
86
87 #------------------------------------------------------------------------------
88 # pgp:  file(1) magic for Pretty Good Privacy
89 #
90 #0       beshort         0x9900                  PGP key public ring
91 #0       beshort         0x9501                  PGP key security ring
92 #0       beshort         0x9500                  PGP key security ring
93 #0      beshort         0xa600                  PGP encrypted data
94 0       string          -----BEGIN\040PGP       PGP armored data,
95 >15     string          PUBLIC\040KEY\040BLOCK- public key block
96 >15     string          MESSAGE-                message
97 >15     string          SIGNED\040MESSAGE-      signed message
98 >15     string          PGP\040SIGNATURE-       signature
99
100 0       string          Salted__                OpenSSL encryption, salted,
101 >8      belong          x                       salt: 0x%X
102 >12     belong          x                       \b%X