This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TESTKEYBOX] Creat tool to create a TestKeyBox.
- Loading branch information
Showing
2 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#include <assert.h> | ||
#include <getopt.h> | ||
#include <time.h> | ||
#include <stdio.h> | ||
#include <stdint.h> | ||
|
||
// This is a test keybox. It (and device certificates derived from it | ||
// through provisioning) will not be accepted by production systems. | ||
|
||
static const uint32_t kKeyboxSystemId_Test = 4121; | ||
|
||
static const uint8_t kKeybox_Test[] = { | ||
// Sample keybox used for test vectors | ||
// deviceID | ||
0x54, 0x65, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x30, // TestKey01 | ||
0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
// key | ||
0xfb, 0xda, 0x04, 0x89, 0xa1, 0x58, 0x16, 0x0e, | ||
0xa4, 0x02, 0xe9, 0x29, 0xe3, 0xb6, 0x8f, 0x04, | ||
// data | ||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x19, | ||
0x07, 0xd9, 0xff, 0xde, 0x13, 0xaa, 0x95, 0xc1, | ||
0x22, 0x67, 0x80, 0x53, 0x36, 0x21, 0x36, 0xbd, | ||
0xf8, 0x40, 0x8f, 0x82, 0x76, 0xe4, 0xc2, 0xd8, | ||
0x7e, 0xc5, 0x2b, 0x61, 0xaa, 0x1b, 0x9f, 0x64, | ||
0x6e, 0x58, 0x73, 0x49, 0x30, 0xac, 0xeb, 0xe8, | ||
0x99, 0xb3, 0xe4, 0x64, 0x18, 0x9a, 0x14, 0xa8, | ||
0x72, 0x02, 0xfb, 0x02, 0x57, 0x4e, 0x70, 0x64, | ||
0x0b, 0xd2, 0x2e, 0xf4, 0x4b, 0x2d, 0x7e, 0x39, | ||
// magic | ||
0x6b, 0x62, 0x6f, 0x78, | ||
// Crc | ||
0x0a, 0x7a, 0x2c, 0x35, | ||
}; | ||
|
||
static const size_t kKeyboxSize_Test = 128; | ||
|
||
static const uint8_t kKeyboxValid02_Test[] = { | ||
// Sample keybox used for test vectors | ||
// deviceID | ||
0x54, 0x65, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x30, // TestKey02 | ||
0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
// key | ||
0x76, 0x5d, 0xce, 0x01, 0x04, 0x89, 0xb3, 0xd0, | ||
0xdf, 0xce, 0x54, 0x8a, 0x49, 0xda, 0xdc, 0xb6, | ||
// data | ||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x19, | ||
0x92, 0x27, 0x0b, 0x1f, 0x1a, 0xd5, 0xc6, 0x93, | ||
0x19, 0x3f, 0xaa, 0x74, 0x1f, 0xdd, 0x5f, 0xb4, | ||
0xe9, 0x40, 0x2f, 0x34, 0xa4, 0x92, 0xf4, 0xae, | ||
0x9a, 0x52, 0x39, 0xbc, 0xb7, 0x24, 0x38, 0x13, | ||
0xab, 0xf4, 0x92, 0x96, 0xc4, 0x81, 0x60, 0x33, | ||
0xd8, 0xb8, 0x09, 0xc7, 0x55, 0x0e, 0x12, 0xfa, | ||
0xa8, 0x98, 0x62, 0x8a, 0xec, 0xea, 0x74, 0x8a, | ||
0x4b, 0xfa, 0x5a, 0x9e, 0xb6, 0x49, 0x0d, 0x80, | ||
// magic | ||
0x6b, 0x62, 0x6f, 0x78, | ||
// Crc | ||
0x2a, 0x3b, 0x3e, 0xe4, | ||
}; | ||
|
||
static const uint8_t kKeyboxValid03_Test[] = { | ||
// Sample keybox used for test vectors | ||
// deviceID | ||
0x54, 0x65, 0x73, 0x74, 0x4b, 0x65, 0x79, 0x30, // TestKey03 | ||
0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ | ||
// key | ||
0x25, 0xe5, 0x2a, 0x02, 0x29, 0x68, 0x04, 0xa2, | ||
0x92, 0xfd, 0x7c, 0x67, 0x0b, 0x67, 0x1f, 0x31, | ||
// data | ||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x10, 0x19, | ||
0xf4, 0x0a, 0x0e, 0xa2, 0x0a, 0x71, 0xd5, 0x92, | ||
0xfa, 0xa3, 0x25, 0xc6, 0x4b, 0x76, 0xf1, 0x64, | ||
0xf4, 0x60, 0xa0, 0x30, 0x72, 0x23, 0xbe, 0x03, | ||
0xcd, 0xde, 0x7a, 0x06, 0xd4, 0x01, 0xeb, 0xdc, | ||
0xe0, 0x50, 0xc0, 0x53, 0x0a, 0x50, 0xb0, 0x37, | ||
0xe5, 0x05, 0x25, 0x0e, 0xa4, 0xc8, 0x5a, 0xff, | ||
0x46, 0x6e, 0xa5, 0x31, 0xf3, 0xdd, 0x94, 0xb7, | ||
0xe0, 0xd3, 0xf9, 0x04, 0xb2, 0x54, 0xb1, 0x64, | ||
// magic | ||
0x6b, 0x62, 0x6f, 0x78, | ||
// Crc | ||
0xa1, 0x99, 0x5f, 0x46, | ||
}; | ||
|
||
int main(int argc, char** argv) { | ||
FILE* outfile; | ||
outfile = fopen("testkeybox.bin", "w"); | ||
if (outfile == NULL) { return 0; } | ||
if (fwrite(kKeybox_Test, 1, | ||
kKeyboxSize_Test, outfile) != 128) { | ||
fclose(outfile); | ||
return -1; | ||
} | ||
if (fwrite(kKeyboxValid02_Test, 1, | ||
kKeyboxSize_Test, outfile) != 128) { | ||
fclose(outfile); | ||
return -1; | ||
} | ||
fclose(outfile); | ||
return (0); | ||
} |
Binary file not shown.