-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Runtime check for EC keys in Secure Session (#693)
* Deny non-EC keys when creating Secure Session. It was possible to create Secure Session by passing private RSA key to `secure_session_create`. But then it would fail while negotiating connection with another peer since Secure Session doesn't actually support RSA keys. This commit make it fail a little bit earlier. * Add test to make sure `secure_session_create` fails with EC public key or any RSA key. * Add test to make sure `secure_session_create` fails with empty peer ID (id == NULL || id_len == 0). * Move test keys for to a different file * Update changelog
- Loading branch information
1 parent
86d9e70
commit bef80bc
Showing
4 changed files
with
221 additions
and
21 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
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
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
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,123 @@ | ||
#ifndef THEMIS_SECURE_SESSION_TEST_KEYS_H | ||
#define THEMIS_SECURE_SESSION_TEST_KEYS_H | ||
|
||
#include <stdint.h> | ||
|
||
static uint8_t client_priv[] = { | ||
0x52, 0x45, 0x43, 0x32, 0x00, 0x00, 0x00, 0x2d, 0x51, 0xf4, 0xaa, 0x72, 0x00, 0x9f, 0x0f, | ||
0x09, 0xce, 0xbe, 0x09, 0x33, 0xc2, 0x5e, 0x9a, 0x05, 0x99, 0x53, 0x9d, 0xb2, 0x32, 0xa2, | ||
0x34, 0x64, 0x7a, 0xde, 0xde, 0x83, 0x8f, 0x65, 0xa9, 0x2a, 0x14, 0x6d, 0xaa, 0x90, 0x01, | ||
}; | ||
static uint8_t client_pub[] = { | ||
0x55, 0x45, 0x43, 0x32, 0x00, 0x00, 0x00, 0x2d, 0x13, 0x8b, 0xdf, 0x0c, 0x02, 0x1f, 0x09, | ||
0x88, 0x39, 0xd9, 0x73, 0x3a, 0x84, 0x8f, 0xa8, 0x50, 0xd9, 0x2b, 0xed, 0x3d, 0x38, 0xcf, | ||
0x1d, 0xd0, 0xce, 0xf4, 0xae, 0xdb, 0xcf, 0xaf, 0xcb, 0x6b, 0xa5, 0x4a, 0x08, 0x11, 0x21, | ||
}; | ||
|
||
static uint8_t server_priv[] = { | ||
0x52, 0x45, 0x43, 0x32, 0x00, 0x00, 0x00, 0x2d, 0x49, 0x87, 0x04, 0x6b, 0x00, 0xf2, 0x06, | ||
0x07, 0x7d, 0xc7, 0x1c, 0x59, 0xa1, 0x8f, 0x39, 0xfc, 0x94, 0x81, 0x3f, 0x9e, 0xc5, 0xba, | ||
0x70, 0x6f, 0x93, 0x08, 0x8d, 0xe3, 0x85, 0x82, 0x5b, 0xf8, 0x3f, 0xc6, 0x9f, 0x0b, 0xdf, | ||
}; | ||
static uint8_t server_pub[] = { | ||
0x55, 0x45, 0x43, 0x32, 0x00, 0x00, 0x00, 0x2d, 0x75, 0x58, 0x33, 0xd4, 0x02, 0x12, 0xdf, | ||
0x1f, 0xe9, 0xea, 0x48, 0x11, 0xe1, 0xf9, 0x71, 0x8e, 0x24, 0x11, 0xcb, 0xfd, 0xc0, 0xa3, | ||
0x6e, 0xd6, 0xac, 0x88, 0xb6, 0x44, 0xc2, 0x9a, 0x24, 0x84, 0xee, 0x50, 0x4c, 0x3e, 0xa0, | ||
}; | ||
|
||
static uint8_t client_priv_rsa[] = { | ||
0x52, 0x52, 0x41, 0x32, 0x00, 0x00, 0x04, 0x90, 0x94, 0x65, 0xbe, 0x5c, 0x75, 0x5e, 0x6a, 0xea, | ||
0xeb, 0x7d, 0x0d, 0x59, 0xa4, 0xe3, 0xc4, 0xb0, 0x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, 0x21, | ||
0x10, 0x24, 0x1c, 0x66, 0xe0, 0x8f, 0x95, 0x90, 0x0d, 0xb9, 0xa6, 0x6d, 0xee, 0xbd, 0xb0, 0x5b, | ||
0x22, 0xdd, 0x64, 0x3c, 0xee, 0x99, 0xf2, 0x5b, 0x9e, 0x77, 0x6e, 0x44, 0x35, 0x4a, 0x53, 0xc2, | ||
0x54, 0x80, 0x0e, 0xb9, 0xc3, 0xed, 0xd2, 0x7e, 0x00, 0xae, 0x8a, 0x5e, 0x98, 0xd3, 0x46, 0xa7, | ||
0xe1, 0x17, 0xf4, 0x5e, 0xa0, 0x3c, 0x18, 0x2b, 0xc2, 0x78, 0x93, 0x15, 0x6b, 0x54, 0x64, 0x87, | ||
0x5b, 0x9a, 0x61, 0xc5, 0xcc, 0x6e, 0x13, 0xee, 0x6a, 0x32, 0xd0, 0x53, 0xc5, 0x54, 0xd7, 0x2c, | ||
0xf4, 0x05, 0x4b, 0x40, 0x70, 0xad, 0x66, 0x37, 0x03, 0x69, 0xc9, 0x99, 0xb2, 0xa8, 0xdb, 0x0c, | ||
0x03, 0x46, 0xd0, 0xfd, 0x2d, 0x50, 0xb0, 0x9a, 0x8d, 0x17, 0x35, 0xb5, 0x2d, 0x8e, 0x3f, 0x24, | ||
0x99, 0x7e, 0x41, 0xc9, 0x76, 0x8f, 0x5f, 0xad, 0x61, 0xc5, 0xbc, 0x12, 0x87, 0xee, 0x38, 0x29, | ||
0x53, 0xfa, 0x81, 0xa2, 0xc2, 0x4d, 0xfa, 0xc1, 0x22, 0x0f, 0xb6, 0x6d, 0x7d, 0xef, 0xcc, 0xb4, | ||
0xa3, 0xac, 0x8e, 0x02, 0x21, 0x8f, 0x00, 0x87, 0x17, 0xe8, 0x98, 0x27, 0x43, 0xf8, 0xfb, 0x5a, | ||
0x8a, 0x93, 0x1a, 0xc8, 0xa8, 0xe9, 0x59, 0x1c, 0x99, 0xfd, 0x70, 0x15, 0x27, 0x50, 0xef, 0xf6, | ||
0x5d, 0x3c, 0xc6, 0x4b, 0x70, 0x8f, 0xcc, 0x64, 0x86, 0xee, 0x0e, 0xfe, 0x5d, 0x6a, 0xce, 0xc8, | ||
0x83, 0x50, 0xc2, 0x70, 0xbd, 0xaa, 0x4d, 0x48, 0x32, 0x95, 0x41, 0x91, 0x61, 0xc7, 0xed, 0xf5, | ||
0x71, 0x79, 0x6e, 0x30, 0x0d, 0x27, 0xa1, 0x0a, 0xb3, 0x8d, 0x36, 0x1d, 0x2f, 0xf2, 0xec, 0xff, | ||
0x45, 0x4d, 0x06, 0x6f, 0x52, 0x20, 0x9c, 0xdb, 0x31, 0x09, 0xe1, 0x48, 0x5b, 0x7d, 0x91, 0x6b, | ||
0x5a, 0x24, 0x10, 0x27, 0x69, 0x18, 0x41, 0x57, 0x98, 0x91, 0x1a, 0x92, 0x9f, 0xd7, 0x9c, 0xc2, | ||
0x58, 0x7d, 0xc7, 0x35, 0x2b, 0xca, 0xed, 0x60, 0xf7, 0xc1, 0x3d, 0x02, 0x47, 0x58, 0x0c, 0x63, | ||
0xe1, 0xa8, 0x91, 0xd2, 0xf1, 0x85, 0xd4, 0xdc, 0xcf, 0x44, 0x91, 0x32, 0xde, 0xd0, 0xd7, 0x87, | ||
0x0d, 0x41, 0x77, 0x54, 0xc5, 0x00, 0xab, 0x02, 0x1e, 0x11, 0xf7, 0xf7, 0xe9, 0x8f, 0x5e, 0x6b, | ||
0x8a, 0xc5, 0xc2, 0x9d, 0xcb, 0x07, 0xfe, 0xc7, 0x09, 0x93, 0x48, 0xb0, 0xcd, 0x6c, 0x7d, 0xf1, | ||
0x14, 0x13, 0xa9, 0x99, 0xdc, 0x9a, 0x9f, 0xc2, 0x72, 0x99, 0xde, 0xce, 0xb4, 0x42, 0x79, 0x0a, | ||
0x33, 0xb0, 0x9e, 0x2f, 0xb6, 0xf0, 0x9a, 0x50, 0x74, 0xb1, 0x0f, 0x5b, 0xb6, 0x2c, 0xf4, 0x02, | ||
0x64, 0x2c, 0x69, 0x2c,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ee, 0x31, 0x6d, 0x77, 0xbd, 0x89, 0x19, 0x15, 0x94, 0xd9, 0xea, | ||
0xd1, 0xaf, 0x69, 0x3a, 0x3f, 0xdf, 0x14, 0xca, 0x27, 0xab, 0xb7, 0x70, 0x58, 0x4b, 0xe8, 0x14, | ||
0x92, 0x4c, 0xcc, 0x56, 0xf8, 0x4c, 0x50, 0x89, 0xea, 0x01, 0xf6, 0x5c, 0x7d, 0x6d, 0xbe, 0x09, | ||
0xda, 0x02, 0x90, 0x7f, 0x29, 0xaa, 0xdc, 0xf3, 0x13, 0x03, 0xc6, 0x8e, 0xd5, 0xed, 0xab, 0x00, | ||
0xf1, 0x68, 0x43, 0x7f, 0xc1, 0x45, 0xd3, 0x1b, 0xb2, 0x14, 0x75, 0x55, 0x00, 0x01, 0x00, 0x01, | ||
}; | ||
static uint8_t client_pub_rsa[] = { | ||
0x55, 0x52, 0x41, 0x32, 0x00, 0x00, 0x01, 0x10, 0xe9, 0x99, 0x84, 0x59, 0xb6, 0x2c, 0xf4, 0x02, | ||
0x64, 0x2c, 0x69, 0x2c, 0x7f, 0x86, 0xcc, 0x11, 0xd4, 0x77, 0x19, 0xfe, 0x4a, 0x09, 0xc3, 0xf3, | ||
0xbd, 0x29, 0xe3, 0x7d, 0x6d, 0x9f, 0x8e, 0x6d, 0xa6, 0x69, 0x3a, 0xc8, 0x23, 0x55, 0x5b, 0x3f, | ||
0xcb, 0x8c, 0xf3, 0x8f, 0x4e, 0x48, 0x05, 0x52, 0x3a, 0xf1, 0x8c, 0x0c, 0xcb, 0xd8, 0x3d, 0xbe, | ||
0x60, 0xd4, 0x17, 0x8a, 0x98, 0x9b, 0x03, 0xb8, 0xd5, 0x0e, 0xd2, 0xb1, 0xe0, 0x67, 0x9c, 0x93, | ||
0xc2, 0xbc, 0xfe, 0x6c, 0x4a, 0x4b, 0x0b, 0x07, 0xe8, 0xe1, 0x15, 0xc5, 0xd1, 0x48, 0xe4, 0xc7, | ||
0xae, 0x0b, 0x06, 0x68, 0x57, 0x9d, 0xd6, 0xe4, 0x2e, 0x8c, 0x85, 0x87, 0x02, 0xf2, 0xb7, 0x36, | ||
0x7e, 0xce, 0x73, 0x70, 0x1c, 0x33, 0x82, 0x4e, 0x4c, 0xdf, 0xfd, 0x59, 0x76, 0xa6, 0xa9, 0x95, | ||
0xd4, 0x79, 0xd7, 0xf1, 0xf3, 0xb9, 0xa6, 0x59, 0x5d, 0x4c, 0xd4, 0x6f, 0xb3, 0x27, 0x07, 0x81, | ||
0xbf, 0xcf, 0xc8, 0x35, 0x95, 0x68, 0x66, 0xab, 0x2d, 0x61, 0xbd, 0x09, 0xbb, 0x16, 0xcf, 0x38, | ||
0x5e, 0x96, 0xeb, 0x93, 0x7a, 0x97, 0x78, 0x50, 0x2d, 0x7d, 0xe3, 0x41, 0x8b, 0xca, 0x6f, 0x07, | ||
0x47, 0x00, 0xcd, 0x13, 0x35, 0xaa, 0x21, 0xcc, 0x46, 0x12, 0x0e, 0x25, 0x45, 0xee, 0x2f, 0x9c, | ||
0x42, 0x09, 0x80, 0x72, 0x99, 0xee, 0x31, 0x6d, 0x77, 0xbd, 0x89, 0x19, 0x15, 0x94, 0xd9, 0xea, | ||
0xd1, 0xaf, 0x69, 0x3a, 0x3f, 0xdf, 0x14, 0xca, 0x27, 0xab, 0xb7, 0x70, 0x58, 0x4b, 0xe8, 0x14, | ||
0x92, 0x4c, 0xcc, 0x56, 0xf8, 0x4c, 0x50, 0x89, 0xea, 0x01, 0xf6, 0x5c, 0x7d, 0x6d, 0xbe, 0x09, | ||
0xda, 0x02, 0x90, 0x7f, 0x29, 0xaa, 0xdc, 0xf3, 0x13, 0x03, 0xc6, 0x8e, 0xd5, 0xed, 0xab, 0x00, | ||
0xf1, 0x68, 0x43, 0x7f, 0xc1, 0x45, 0xd3, 0x1b, 0xb2, 0x14, 0x75, 0x55, 0x00, 0x01, 0x00, 0x01, | ||
}; | ||
|
||
#endif /* THEMIS_SECURE_SESSION_TEST_KEYS_H */ |