1 /*
2  * Copyright (C) 2018, Linaro, Ltd
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  */
6 
7 #if defined(CONFIG_JWT_SIGN_RSA_PSA) || defined(CONFIG_JWT_SIGN_RSA_LEGACY)
8 
9 /* To generate the key in the correct format use the following command:
10  * $ openssl genrsa 2048 | openssl rsa -outform DER | xxd -i
11  */
12 
13 unsigned char jwt_test_private_der[] = {
14 	0x30, 0x82, 0x04, 0xa5, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
15 	0xc3, 0x10, 0x4f, 0x09, 0xcb, 0xfa, 0xfc, 0xc6, 0xb3, 0x93, 0x38, 0x00,
16 	0x6b, 0x0c, 0x6a, 0x68, 0xa8, 0x65, 0x0b, 0xf3, 0x88, 0x57, 0x0f, 0x94,
17 	0x5c, 0xf0, 0x93, 0xb1, 0x24, 0xff, 0x3e, 0xe8, 0x6b, 0xf3, 0xbd, 0xd1,
18 	0xd3, 0x9e, 0x64, 0x2e, 0x65, 0xfd, 0x2f, 0x57, 0xe9, 0x8d, 0x12, 0x4b,
19 	0xae, 0x3f, 0xe5, 0x04, 0x77, 0xa9, 0x78, 0x1f, 0x8a, 0xe8, 0x03, 0x6c,
20 	0x06, 0x6f, 0x9e, 0x77, 0x5c, 0xfe, 0x87, 0x2a, 0xb3, 0xb7, 0x7f, 0xaa,
21 	0xe1, 0x9b, 0x2b, 0x79, 0x69, 0xac, 0x06, 0xb3, 0x2e, 0x2f, 0x0d, 0x3a,
22 	0x99, 0x06, 0xf4, 0xb1, 0x0a, 0x3a, 0x90, 0x75, 0x18, 0x29, 0x48, 0xc4,
23 	0x2b, 0xd0, 0x67, 0x41, 0x4b, 0x82, 0x47, 0xf3, 0xae, 0x6d, 0x05, 0x37,
24 	0xe4, 0x4d, 0x7e, 0x19, 0x61, 0x2c, 0xb1, 0x4c, 0x9e, 0x05, 0xcb, 0x98,
25 	0x7d, 0x1c, 0x92, 0x90, 0xff, 0xef, 0xa0, 0x5c, 0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91, 0xc9, 0xde, 0xb1, 0x9f, 0xda, 0x4a, 0xc1, 0xb0, 0x9a,
100 	0x1e, 0xc8, 0x4a, 0x58, 0x84, 0x4d, 0x1d, 0x2a, 0xf8, 0xed, 0xb0, 0x07,
101 	0x9c, 0xc6, 0x0d, 0x31, 0xef, 0x34, 0xa2, 0x35, 0xe9, 0xf0, 0x77, 0x09,
102 	0xd0, 0xce, 0xa0, 0x1f, 0xa7, 0x02, 0x81, 0x81, 0x00, 0xb0, 0x9d, 0xd2,
103 	0x7f, 0xff, 0xe0, 0x86, 0x3e, 0x5f, 0xfe, 0x83, 0xf6, 0x51, 0xa3, 0x09,
104 	0xb2, 0xb6, 0x4a, 0xe0, 0xdf, 0xd9, 0xdd, 0x2a, 0x9f, 0x68, 0x4c, 0xb2,
105 	0x4f, 0x12, 0x1d, 0x07, 0xb8, 0x75, 0x70, 0x28, 0x7a, 0x49, 0xaa, 0x56,
106 	0x53, 0x7a, 0xc7, 0xbf, 0xbd, 0xea, 0x38, 0x2c, 0xf0, 0x91, 0xf6, 0x71,
107 	0x1e, 0x97, 0x10, 0x20, 0x79, 0x2b, 0x24, 0x6c, 0x1c, 0x7b, 0x2e, 0x96,
108 	0x8c, 0x72, 0x13, 0xc1, 0x60, 0x7c, 0x41, 0x20, 0x8b, 0x36, 0x4c, 0xe2,
109 	0x65, 0x8d, 0xc5, 0x0e, 0x1e, 0x34, 0x01, 0x6d, 0x45, 0x48, 0x86, 0x6e,
110 	0x45, 0x43, 0xf4, 0xff, 0xb8, 0xa0, 0xa8, 0x07, 0x49, 0x54, 0x92, 0x0f,
111 	0x53, 0xe9, 0x2c, 0xd3, 0xdb, 0x6a, 0x8a, 0xeb, 0xc4, 0x15, 0x51, 0xdf,
112 	0x9c, 0x1a, 0x1a, 0x20, 0x8a, 0xed, 0xfe, 0xef, 0xe8, 0xe1, 0x04, 0x14,
113 	0x05, 0xfd, 0x71, 0xb0, 0x3e
114 };
115 
116 #else /* CONFIG_JWT_SIGN_ECDSA_PSA */
117 
118 /* Here's how to generate the key in the correct format:
119  * - generate the key using OpenSSL:
120  *   $ openssl ecparam -name prime256v1 -genkey | openssl ec -outform der | xxd -ps
121  * - copy the content to https://lapo.it/asn1js/
122  * - get the first OCTECT STRING, which is the private key, and copy it here
123  */
124 
125 unsigned char jwt_test_private_der[] = {
126 	0xAA, 0xE2, 0xA4, 0x5F, 0x3B, 0xC4, 0xCB, 0xA5, 0x0B, 0x17, 0xAE, 0x55,
127 	0x4D, 0x21, 0x1B, 0xB0, 0xCC, 0x71, 0x42, 0x74, 0xBF, 0x1D, 0xC6, 0x5B,
128 	0xF9, 0x50, 0x93, 0x06, 0x7B, 0xCE, 0x9D, 0x75
129 };
130 
131 #endif
132 
133 unsigned int jwt_test_private_der_len = sizeof(jwt_test_private_der);
134