summaryrefslogtreecommitdiff
path: root/test/rsa3072-3.h
blob: c407a4ed2b5b690f09aa43e48dbedcd316aec274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* Copyright 2020 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 * RSA 3072 with 3 exponent public key and verification.
 * Private key in rsa3072-3.pem.
 */

/* First generate a key:
 * # openssl genrsa -3 -out key.pem 3072
 * # openssl rsa -in key.pem -pubout > key.pub
 * Then dump the key: sudo emerge vboot_reference
 * # /usr/bin/dumpRSAPublicKey -pub key.pub | xxd -i
 */
const uint8_t rsa_data[] = {
	0x60, 0x00, 0x00, 0x00, 0xdd, 0x54, 0xe6, 0xe2, 0x8b, 0xdc, 0xea, 0xd2,
	0x58, 0x10, 0x72, 0xf1, 0x39, 0x2d, 0x10, 0x6e, 0x37, 0x4b, 0x19, 0x0d,
	0x0a, 0x02, 0x80, 0xdc, 0xb9, 0xee, 0xb4, 0x6b, 0xb6, 0x19, 0x73, 0x22,
	0x43, 0x09, 0x22, 0x7e, 0xf1, 0x48, 0xdd, 0xf2, 0x66, 0x12, 0x90, 0xb9,
	0x58, 0x54, 0x4b, 0xc4, 0xce, 0xf0, 0xb3, 0xbf, 0xad, 0x86, 0x1a, 0x6a,
	0x23, 0x66, 0x08, 0x10, 0x83, 0xda, 0xa3, 0xec, 0x8e, 0x36, 0x2d, 0xb2,
	0x91, 0x2c, 0xbd, 0x11, 0x2f, 0xa8, 0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, 0x06, 0x37, 0x86, 0xf9, 0x64, 0xe4, 0xcf, 0x49, 0x0b,
	0x20, 0x21, 0xda, 0x0a, 0x25, 0xd4, 0x17, 0x21, 0x73, 0x39, 0xf9, 0x2f,
	0xeb, 0x81, 0x6f, 0x90, 0xea, 0x83, 0xfc, 0xc7, 0xe9, 0x44, 0xd1, 0xd2,
	0x8b, 0xc5, 0xf3, 0x1f, 0x35, 0x1c, 0xc5, 0xa3, 0x75, 0x36, 0xb7, 0x84,
	0xed, 0x67, 0xa0, 0xbd, 0xaf, 0x6b, 0x00, 0x15, 0x5a, 0x7c, 0x5c, 0xc7,
	0x95, 0x22, 0x76, 0xd9, 0x9c, 0x1f, 0xf0, 0xb2, 0x6e, 0x5b, 0xcb, 0x32,
	0x88, 0xa4, 0xc6, 0x7f, 0xfa, 0x2e, 0xc6, 0x40, 0x40, 0xa3, 0xe2, 0x57,
	0xb7, 0x08, 0xe0, 0xe9, 0x93, 0x10, 0x95, 0x70, 0x2d, 0x90, 0x0c, 0xeb,
	0x44, 0x50, 0xbc, 0xd9, 0xc7, 0xd5, 0x2b, 0x74, 0xac, 0x6e, 0x7f, 0xcf,
	0xfa, 0x8c, 0xf6, 0x76, 0x77, 0x79, 0xf8, 0xf4, 0x11, 0x8e, 0x5a, 0xe4,
	0x2c, 0xa2, 0x84, 0x56, 0xdb, 0x39, 0x54, 0x82, 0x8e, 0x85, 0x31, 0xc0,
	0x51, 0xf7, 0x6c, 0x2c, 0x5f, 0xbc, 0x63, 0x5c, 0xf3, 0x68, 0x4e, 0xa4,
	0x52, 0xc9, 0xe8, 0x06, 0xff, 0x94, 0xd3, 0xa1,
};

const struct rsa_public_key *rsa_key = (struct rsa_public_key *)rsa_data;
BUILD_ASSERT(sizeof(*rsa_key) == sizeof(rsa_data));

/* SHA-256 sum to verify:
 * # sha256sum README.md | sed -e 's/\(..\)/0x\1, /mg'
 */
const uint8_t hash[] = { 0xc7, 0xc3, 0xd0, 0xa3, 0x7e, 0xbd, 0x50, 0xe8,
			 0x3c, 0xb3, 0x5b, 0xed, 0x02, 0xf9, 0x8f, 0x97,
			 0xf8, 0xb5, 0x23, 0x43, 0x74, 0xda, 0x0a, 0x24,
			 0xdb, 0x04, 0xe4, 0x1e, 0xbd, 0x43, 0x02, 0xdc };

/* Incorrect hash to test the negative case */
const uint8_t hash_wrong[] = { 0x61, 0x1b, 0xd2, 0x44, 0xc7, 0x18, 0xa7, 0x2d,
			       0x0f, 0x2d, 0x3d, 0x0f, 0xe3, 0xb3, 0xc5, 0xe4,
			       0x12, 0xc2, 0x7b, 0x1e, 0x05, 0x2c, 0x6f, 0xad,
			       0xc4, 0xac, 0x71, 0x55, 0xe8, 0x80, 0x5c, 0x38 };

/* Generate signature using openssl:
 * openssl dgst -sha256 -sign test/rsa3072-3.pem README.md | xxd -i
 */
const uint8_t sig[] = {
	0xb3, 0xac, 0xcb, 0x5c, 0xbc, 0x82, 0x74, 0x14, 0xce, 0x7d, 0xbd, 0x3b,
	0xc6, 0x6e, 0x2d, 0x3e, 0xfd, 0xdb, 0x76, 0xb3, 0xfe, 0xed, 0x29, 0xd6,
	0xb8, 0x20, 0x8a, 0x79, 0xf8, 0xe4, 0x1b, 0xc1, 0x99, 0x21, 0x77, 0xb0,
	0xa7, 0x49, 0xfc, 0x31, 0x70, 0xe2, 0x5c, 0xc9, 0xc4, 0xc8, 0x5b, 0xbd,
	0xf9, 0xc9, 0x81, 0x43, 0x7e, 0x16, 0x23, 0xc7, 0xb3, 0x8f, 0x95, 0xca,
	0xb2, 0x56, 0x96, 0xfc, 0x53, 0xba, 0xf3, 0x77, 0x31, 0xde, 0x69, 0x9f,
	0x2e, 0xb1, 0xc0, 0xe1, 0xb9, 0x05, 0x7a, 0xf2, 0x92, 0x9c, 0xf2, 0x0b,
	0x54, 0xa1, 0x93, 0x58, 0x52, 0x2e, 0x9b, 0x02, 0x59, 0x05, 0x67, 0xc2,
	0x8c, 0x27, 0x1d, 0xc2, 0x70, 0x2f, 0x5c, 0x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