libtomcrypt/tests/ecc_test.c

1602 lines
94 KiB
C
Raw Normal View History

2020-06-17 08:15:27 +00:00
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
2005-04-17 11:37:13 +00:00
#include <tomcrypt_test.h>
2004-05-31 02:36:47 +00:00
#if defined(LTC_MECC)
2004-10-30 03:00:26 +00:00
2014-05-01 16:01:13 +00:00
static unsigned int sizes[] = {
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP112R1
2006-11-17 14:21:24 +00:00
14,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP128R1
2006-11-17 14:21:24 +00:00
16,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP160R1
2006-11-17 14:21:24 +00:00
20,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP192R1
2005-06-09 00:08:13 +00:00
24,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP224R1
2005-06-09 00:08:13 +00:00
28,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP256R1
2005-06-09 00:08:13 +00:00
32,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP384R1
2005-06-09 00:08:13 +00:00
48,
#endif
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SECP512R1
66
2005-06-09 00:08:13 +00:00
#endif
};
static const char* curvenames[] = {
#ifdef LTC_ECC_SECP112R1
"SECP112R1", "ECC-112",
"secp112r1", /* name is case-insensitive */
"S E C-P-1_1_2r1", /* should pass fuzzy matching */
#endif
#ifdef LTC_ECC_SECP112R2
"SECP112R2",
#endif
#ifdef LTC_ECC_SECP128R1
"SECP128R1", "ECC-128",
#endif
#ifdef LTC_ECC_SECP128R2
"SECP128R2",
#endif
#ifdef LTC_ECC_SECP160R1
"SECP160R1", "ECC-160",
#endif
#ifdef LTC_ECC_SECP160R2
"SECP160R2",
#endif
#ifdef LTC_ECC_SECP160K1
"SECP160K1",
#endif
#ifdef LTC_ECC_BRAINPOOLP160R1
"BRAINPOOLP160R1",
#endif
#ifdef LTC_ECC_SECP192R1
"SECP192R1", "NISTP192", "PRIME192V1", "ECC-192", "P-192",
#endif
#ifdef LTC_ECC_PRIME192V2
"PRIME192V2",
#endif
#ifdef LTC_ECC_PRIME192V3
"PRIME192V3",
#endif
#ifdef LTC_ECC_SECP192K1
"SECP192K1",
#endif
#ifdef LTC_ECC_BRAINPOOLP192R1
"BRAINPOOLP192R1",
#endif
#ifdef LTC_ECC_SECP224R1
"SECP224R1", "NISTP224", "ECC-224", "P-224",
#endif
#ifdef LTC_ECC_SECP224K1
"SECP224K1",
#endif
#ifdef LTC_ECC_BRAINPOOLP224R1
"BRAINPOOLP224R1",
#endif
#ifdef LTC_ECC_PRIME239V1
"PRIME239V1",
#endif
#ifdef LTC_ECC_PRIME239V2
"PRIME239V2",
#endif
#ifdef LTC_ECC_PRIME239V3
"PRIME239V3",
#endif
#ifdef LTC_ECC_SECP256R1
"SECP256R1", "NISTP256", "PRIME256V1", "ECC-256", "P-256",
#endif
#ifdef LTC_ECC_SECP256K1
"SECP256K1",
#endif
#ifdef LTC_ECC_BRAINPOOLP256R1
"BRAINPOOLP256R1",
#endif
#ifdef LTC_ECC_BRAINPOOLP320R1
"BRAINPOOLP320R1",
#endif
#ifdef LTC_ECC_SECP384R1
"SECP384R1", "NISTP384", "ECC-384", "P-384",
#endif
#ifdef LTC_ECC_BRAINPOOLP384R1
"BRAINPOOLP384R1",
#endif
#ifdef LTC_ECC_BRAINPOOLP512R1
"BRAINPOOLP512R1",
#endif
#ifdef LTC_ECC_SECP521R1
"SECP521R1", "NISTP521", "ECC-521", "P-521",
#endif
};
2006-12-16 18:10:04 +00:00
#ifdef LTC_ECC_SHAMIR
static int s_ecc_test_shamir(void)
2006-12-16 18:10:04 +00:00
{
2017-12-19 12:31:50 +00:00
void *a, *modulus, *mp, *kA, *kB, *rA, *rB;
void *mu, *ma;
2006-12-16 18:10:04 +00:00
ecc_point *G, *A, *B, *C1, *C2;
int x, y, z;
unsigned char buf[ECC_BUF_SIZE];
2017-12-19 12:31:50 +00:00
DO(mp_init_multi(&kA, &kB, &rA, &rB, &modulus, &a, &mu, &ma, NULL));
2006-12-16 18:10:04 +00:00
LTC_ARGCHK((G = ltc_ecc_new_point()) != NULL);
LTC_ARGCHK((A = ltc_ecc_new_point()) != NULL);
LTC_ARGCHK((B = ltc_ecc_new_point()) != NULL);
LTC_ARGCHK((C1 = ltc_ecc_new_point()) != NULL);
LTC_ARGCHK((C2 = ltc_ecc_new_point()) != NULL);
for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) {
/* get the base point */
2017-12-19 12:31:50 +00:00
for (z = 0; ltc_ecc_curves[z].prime != NULL; z++) {
DO(mp_read_radix(modulus, ltc_ecc_curves[z].prime, 16));
if (sizes[x] <= mp_unsigned_bin_size(modulus)) break;
2006-12-16 18:10:04 +00:00
}
2017-12-19 12:31:50 +00:00
LTC_ARGCHK(ltc_ecc_curves[z].prime != NULL);
2006-12-16 18:10:04 +00:00
/* load it */
2017-12-19 12:31:50 +00:00
DO(mp_read_radix(G->x, ltc_ecc_curves[z].Gx, 16));
DO(mp_read_radix(G->y, ltc_ecc_curves[z].Gy, 16));
2006-12-16 18:10:04 +00:00
DO(mp_set(G->z, 1));
2017-12-19 12:31:50 +00:00
DO(mp_read_radix(a, ltc_ecc_curves[z].A, 16));
2006-12-16 18:10:04 +00:00
DO(mp_montgomery_setup(modulus, &mp));
2017-12-19 12:31:50 +00:00
DO(mp_montgomery_normalization(mu, modulus));
DO(mp_mulmod(a, mu, modulus, ma));
2006-12-16 18:10:04 +00:00
/* do 100 random tests */
for (y = 0; y < 100; y++) {
/* pick a random r1, r2 */
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
DO(mp_read_unsigned_bin(rA, buf, sizes[x]));
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
DO(mp_read_unsigned_bin(rB, buf, sizes[x]));
/* compute rA * G = A */
2017-12-19 12:31:50 +00:00
DO(ltc_mp.ecc_ptmul(rA, G, A, a, modulus, 1));
2014-05-01 16:01:13 +00:00
2006-12-16 18:10:04 +00:00
/* compute rB * G = B */
2017-12-19 12:31:50 +00:00
DO(ltc_mp.ecc_ptmul(rB, G, B, a, modulus, 1));
2006-12-16 18:10:04 +00:00
/* pick a random kA, kB */
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
DO(mp_read_unsigned_bin(kA, buf, sizes[x]));
LTC_ARGCHK(yarrow_read(buf, sizes[x], &yarrow_prng) == sizes[x]);
DO(mp_read_unsigned_bin(kB, buf, sizes[x]));
/* now, compute kA*A + kB*B = C1 using the older method */
2017-12-19 12:31:50 +00:00
DO(ltc_mp.ecc_ptmul(kA, A, C1, a, modulus, 0));
DO(ltc_mp.ecc_ptmul(kB, B, C2, a, modulus, 0));
DO(ltc_mp.ecc_ptadd(C1, C2, C1, a, modulus, mp));
2006-12-16 18:10:04 +00:00
DO(ltc_mp.ecc_map(C1, modulus, mp));
/* now compute using mul2add */
2017-12-19 12:31:50 +00:00
DO(ltc_mp.ecc_mul2add(A, kA, B, kB, C2, ma, modulus));
2006-12-16 18:10:04 +00:00
/* is they the sames? */
if ((mp_cmp(C1->x, C2->x) != LTC_MP_EQ) || (mp_cmp(C1->y, C2->y) != LTC_MP_EQ) || (mp_cmp(C1->z, C2->z) != LTC_MP_EQ)) {
fprintf(stderr, "ECC failed shamir test: size=%d, testno=%d\n", sizes[x], y);
return 1;
}
}
mp_montgomery_free(mp);
}
ltc_ecc_del_point(C2);
ltc_ecc_del_point(C1);
ltc_ecc_del_point(B);
ltc_ecc_del_point(A);
ltc_ecc_del_point(G);
2017-12-19 12:31:50 +00:00
mp_clear_multi(kA, kB, rA, rB, modulus, a, mu, ma, NULL);
2006-12-16 18:10:04 +00:00
return 0;
}
#endif
/* https://github.com/libtom/libtomcrypt/issues/108 */
static int s_ecc_issue108(void)
2004-05-31 02:36:47 +00:00
{
2017-12-19 12:31:50 +00:00
void *a, *modulus, *order;
ecc_point *Q, *Result;
int err;
const ltc_ecc_curve* dp;
/* init */
if ((err = mp_init_multi(&modulus, &order, &a, NULL)) != CRYPT_OK) { return err; }
Q = ltc_ecc_new_point();
Result = ltc_ecc_new_point();
/* ECC-224 AKA SECP224R1 */
2018-07-04 08:38:38 +00:00
if ((err = ecc_find_curve("SECP224R1", &dp)) != CRYPT_OK) { goto done; }
2017-12-19 12:31:50 +00:00
/* read A */
if ((err = mp_read_radix(a, (char *)dp->A, 16)) != CRYPT_OK) { goto done; }
/* read modulus */
if ((err = mp_read_radix(modulus, (char *)dp->prime, 16)) != CRYPT_OK) { goto done; }
/* read order */
if ((err = mp_read_radix(order, (char *)dp->order, 16)) != CRYPT_OK) { goto done; }
/* read Q */
if ((err = mp_read_radix(Q->x, (char *)"EA3745501BBC6A70BBFDD8AEEDB18CF5073C6DC9AA7CBB5915170D60", 16)) != CRYPT_OK) { goto done; }
if ((err = mp_read_radix(Q->y, (char *)"6C9CB8E68AABFEC989CAC5E2326E0448B7E69C3E56039BA21A44FDAC", 16)) != CRYPT_OK) { goto done; }
mp_set(Q->z, 1);
/* calculate nQ */
if ((err = ltc_mp.ecc_ptmul(order, Q, Result, a, modulus, 1)) != CRYPT_OK) { goto done; }
done:
ltc_ecc_del_point(Result);
ltc_ecc_del_point(Q);
mp_clear_multi(modulus, order, a, NULL);
return err;
}
/* https://github.com/libtom/libtomcrypt/issues/443 */
2018-10-07 20:11:46 +00:00
/* https://github.com/libtom/libtomcrypt/issues/447 */
static int s_ecc_issue443_447(void)
{
const ltc_ecc_curve* cu;
ecc_key key;
2018-10-07 20:11:46 +00:00
int err, stat = 0;
unsigned char hash[64];
unsigned long hashlen;
const unsigned char msg[] = { 0x54,0x65,0x73,0x74 };
/* msg+pub1+sig1 test vector is from wycheproof - ecdsa_webcrypto_test (incorrect size of signature) */
const unsigned char pub1[] = {
0x04,
0x4a,0x03,0xef,0x9f,0x92,0xeb,0x26,0x8c,0xaf,0xa6,0x01,0x07,0x24,0x89,0xa5,0x63,
0x80,0xfa,0x0d,0xc4,0x31,0x71,0xd7,0x71,0x28,0x13,0xb3,0xa1,0x9a,0x1e,0xb5,0xe5,
0x3e,0x21,0x3e,0x28,0xa6,0x08,0xce,0x9a,0x2f,0x4a,0x17,0xfd,0x83,0x0c,0x66,0x54,
0x01,0x8a,0x79,0xb3,0xe0,0x26,0x3d,0x91,0xa8,0xba,0x90,0x62,0x2d,0xf6,0xf2,0xf0
};
const unsigned char sig1[] = { 0x05, 0x01 };
/* msg+pub2+sig2 test vector is from wycheproof - ecdsa_webcrypto_test (incorrect size of signature) */
const unsigned char pub2[] = {
0x04,
0x00,0x5f,0x50,0x59,0x30,0x83,0x49,0xf9,0xeb,0xbb,0x4d,0x1c,0x55,0xc0,0xaf,0xcc,0xf6,0x21,0x62,0xec,0x1d,0xd1,
0x2e,0xf3,0xed,0x90,0x66,0x56,0x92,0x4f,0xfd,0x99,0xca,0xb9,0xf0,0x6b,0x0e,0xb2,0x18,0xcf,0xf0,0x78,0xa4,0x67,
0x7a,0x5c,0xe1,0xcc,0x07,0x65,0x2b,0xc9,0x76,0xae,0xfc,0x73,0x2c,0x28,0xf6,0x7e,0xf0,0x78,0xa4,0x34,0xe9,0x99,
0x00,0xa5,0xd1,0x4d,0xf3,0x10,0x63,0x0d,0x76,0xec,0x03,0xcb,0x6f,0x9b,0x95,0xbf,0x1a,0x22,0x43,0x81,0x05,0xc8,
0x8c,0xd9,0xfd,0x3d,0xac,0x80,0xf8,0x57,0xad,0xd3,0x82,0x71,0xd8,0xba,0x90,0x16,0x84,0xb2,0x6d,0x43,0x6d,0x4a,
0x85,0x9a,0xd4,0xcd,0xa5,0xe9,0x67,0x7b,0x73,0xca,0xb3,0xf3,0xe5,0xe4,0x1a,0x3d,0x79,0x96,0x60,0x72,0x79,0xab
};
const unsigned char sig2[] = { 0x01, 0x01 };
hashlen = sizeof(hash);
DO(hash_memory(find_hash("sha256"), msg, sizeof(msg), hash, &hashlen));
DO(ecc_find_curve("secp256r1", &cu));
DO(ecc_set_curve(cu, &key));
DO(ecc_set_key(pub1, sizeof(pub1), PK_PUBLIC, &key));
2018-10-07 20:11:46 +00:00
err = ecc_verify_hash_rfc7518(sig1, sizeof(sig1), hash, hashlen, &stat, &key); /* should fail */
ecc_free(&key);
2018-10-07 20:11:46 +00:00
if (err != CRYPT_INVALID_PACKET) return CRYPT_FAIL_TESTVECTOR;
hashlen = sizeof(hash);
DO(hash_memory(find_hash("sha512"), msg, sizeof(msg), hash, &hashlen));
DO(ecc_find_curve("secp521r1", &cu));
DO(ecc_set_curve(cu, &key));
DO(ecc_set_key(pub2, sizeof(pub2), PK_PUBLIC, &key));
2018-10-07 20:11:46 +00:00
err = ecc_verify_hash_rfc7518(sig2, sizeof(sig2), hash, hashlen, &stat, &key); /* should fail */
ecc_free(&key);
2018-10-07 20:11:46 +00:00
if (err != CRYPT_INVALID_PACKET) return CRYPT_FAIL_TESTVECTOR;
return CRYPT_OK;
}
static int s_ecc_test_mp(void)
2017-12-19 12:31:50 +00:00
{
void *a, *modulus, *order;
ecc_point *G, *GG;
int i, err, primality;
2019-04-10 07:47:20 +00:00
char buf[4096];
2017-12-19 12:31:50 +00:00
2019-04-10 07:47:20 +00:00
DO(mp_init_multi(&modulus, &order, &a, NULL));
2017-12-19 12:31:50 +00:00
G = ltc_ecc_new_point();
GG = ltc_ecc_new_point();
if (G == NULL || GG == NULL) {
mp_clear_multi(modulus, order, NULL);
ltc_ecc_del_point(G);
ltc_ecc_del_point(GG);
return CRYPT_MEM;
}
2019-04-10 07:47:20 +00:00
err = CRYPT_OK;
2017-12-19 12:31:50 +00:00
for (i = 0; ltc_ecc_curves[i].prime != NULL; i++) {
2019-04-10 07:47:20 +00:00
DO(mp_read_radix(a, (char *)ltc_ecc_curves[i].A, 16));
DO(mp_read_radix(modulus, (char *)ltc_ecc_curves[i].prime, 16));
DO(mp_read_radix(order, (char *)ltc_ecc_curves[i].order, 16));
2017-12-19 12:31:50 +00:00
/* is prime actually prime? */
2019-04-10 07:47:20 +00:00
DO(mp_prime_is_prime(modulus, 8, &primality));
2017-12-19 12:31:50 +00:00
if (primality == 0) {
err = CRYPT_FAIL_TESTVECTOR;
2019-04-10 07:47:20 +00:00
mp_tohex(modulus, buf);
printf("Modulus failed prime check: %s\n", buf);
2017-12-19 12:31:50 +00:00
}
/* is order prime ? */
2019-04-10 07:47:20 +00:00
DO(mp_prime_is_prime(order, 8, &primality));
2017-12-19 12:31:50 +00:00
if (primality == 0) {
err = CRYPT_FAIL_TESTVECTOR;
2019-04-10 07:47:20 +00:00
mp_tohex(order, buf);
printf("Order failed prime check: %s\n", buf);
2017-12-19 12:31:50 +00:00
}
2019-04-10 07:47:20 +00:00
DO(mp_read_radix(G->x, (char *)ltc_ecc_curves[i].Gx, 16));
DO(mp_read_radix(G->y, (char *)ltc_ecc_curves[i].Gy, 16));
2017-12-19 12:31:50 +00:00
mp_set(G->z, 1);
/* then we should have G == (order + 1)G */
2019-04-10 07:47:20 +00:00
DO(mp_add_d(order, 1, order));
DO(ltc_mp.ecc_ptmul(order, G, GG, a, modulus, 1));
2017-12-19 12:31:50 +00:00
if (mp_cmp(G->x, GG->x) != LTC_MP_EQ || mp_cmp(G->y, GG->y) != LTC_MP_EQ) {
err = CRYPT_FAIL_TESTVECTOR;
2019-04-10 07:47:20 +00:00
}
if (err != CRYPT_OK) {
2017-12-19 12:31:50 +00:00
goto done;
}
}
err = CRYPT_OK;
done:
ltc_ecc_del_point(GG);
ltc_ecc_del_point(G);
mp_clear_multi(order, modulus, a, NULL);
return err;
}
static int s_ecc_old_api(void)
2017-12-19 12:31:50 +00:00
{
unsigned char buf[4][4096], ch;
unsigned long x, y, z, s;
int stat, stat2;
ecc_key usera, userb, pubKey, privKey;
int low, high;
ecc_sizes(&low, &high);
if (low < 14 || high < 14 || low > 100 || high > 100 || high < low) return CRYPT_FAIL_TESTVECTOR;
for (s = 0; s < (sizeof(sizes)/sizeof(sizes[0])); s++) {
/* make up two keys */
DO(ecc_make_key (&yarrow_prng, find_prng ("yarrow"), sizes[s], &usera));
DO(ecc_make_key (&yarrow_prng, find_prng ("yarrow"), sizes[s], &userb));
if (ecc_get_size(&usera) != (int)sizes[s]) return CRYPT_FAIL_TESTVECTOR;
if (ecc_get_size(&userb) != (int)sizes[s]) return CRYPT_FAIL_TESTVECTOR;
/* make the shared secret */
x = sizeof(buf[0]);
DO(ecc_shared_secret (&usera, &userb, buf[0], &x));
y = sizeof(buf[1]);
DO(ecc_shared_secret (&userb, &usera, buf[1], &y));
2020-03-27 09:54:03 +00:00
DO(do_compare_testvector(buf[0], x, buf[1], y, "ecc Shared keys", s));
2017-12-19 12:31:50 +00:00
/* now export userb */
y = sizeof(buf[0]);
DO(ecc_export (buf[1], &y, PK_PUBLIC, &userb));
ecc_free (&userb);
/* import and make the shared secret again */
DO(ecc_import (buf[1], y, &userb));
z = sizeof(buf[0]);
DO(ecc_shared_secret (&usera, &userb, buf[2], &z));
if (z != x) {
fprintf(stderr, "failed. Size don't match?");
return 1;
}
if (memcmp (buf[0], buf[2], x)) {
fprintf(stderr, "Failed. Contents didn't match.");
return 1;
}
/* export with ANSI X9.63 */
y = sizeof(buf[1]);
DO(ecc_ansi_x963_export(&userb, buf[1], &y));
ecc_free (&userb);
/* now import the ANSI key */
DO(ecc_ansi_x963_import(buf[1], y, &userb));
/* shared secret */
z = sizeof(buf[0]);
DO(ecc_shared_secret (&usera, &userb, buf[2], &z));
if (z != x) {
fprintf(stderr, "failed. Size don't match?");
return 1;
}
if (memcmp (buf[0], buf[2], x)) {
fprintf(stderr, "Failed. Contents didn't match.");
return 1;
}
ecc_free (&usera);
ecc_free (&userb);
/* test encrypt_key */
DO(ecc_make_key (&yarrow_prng, find_prng ("yarrow"), sizes[s], &usera));
/* export key */
x = sizeof(buf[0]);
DO(ecc_export(buf[0], &x, PK_PUBLIC, &usera));
DO(ecc_import(buf[0], x, &pubKey));
x = sizeof(buf[0]);
DO(ecc_export(buf[0], &x, PK_PRIVATE, &usera));
DO(ecc_import(buf[0], x, &privKey));
for (ch = 0; ch < 32; ch++) {
buf[0][ch] = ch;
}
y = sizeof (buf[1]);
DO(ecc_encrypt_key (buf[0], 32, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("sha256"), &pubKey));
zeromem (buf[0], sizeof (buf[0]));
x = sizeof (buf[0]);
DO(ecc_decrypt_key (buf[1], y, buf[0], &x, &privKey));
if (x != 32) {
fprintf(stderr, "Failed (length)");
return 1;
}
for (ch = 0; ch < 32; ch++) {
if (buf[0][ch] != ch) {
fprintf(stderr, "Failed (contents)");
return 1;
}
}
/* test sign_hash */
for (ch = 0; ch < 16; ch++) {
buf[0][ch] = ch;
}
x = sizeof (buf[1]);
DO(ecc_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey));
DO(ecc_verify_hash (buf[1], x, buf[0], 16, &stat, &pubKey));
buf[0][0] ^= 1;
DO(ecc_verify_hash (buf[1], x, buf[0], 16, &stat2, &privKey));
if (!(stat == 1 && stat2 == 0)) {
fprintf(stderr, "ecc_verify_hash failed %d, %d, ", stat, stat2);
return 1;
}
/* test sign_hash_rfc7518 */
for (ch = 0; ch < 16; ch++) {
buf[0][ch] = ch;
}
x = sizeof (buf[1]);
DO(ecc_sign_hash_rfc7518(buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey));
DO(ecc_verify_hash_rfc7518(buf[1], x, buf[0], 16, &stat, &pubKey));
buf[0][0] ^= 1;
DO(ecc_verify_hash_rfc7518(buf[1], x, buf[0], 16, &stat2, &privKey));
if (!(stat == 1 && stat2 == 0)) {
fprintf(stderr, "ecc_verify_hash_rfc7518 failed %d, %d, ", stat, stat2);
return 1;
}
ecc_free (&usera);
ecc_free (&pubKey);
ecc_free (&privKey);
}
return CRYPT_OK;
2004-05-31 02:36:47 +00:00
}
2004-10-30 03:00:26 +00:00
static int s_ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is)
{
if (should_type != is->type) return CRYPT_ERROR;
if (should_type == PK_PRIVATE) {
if (mp_cmp(should->k, is->k) != LTC_MP_EQ) return CRYPT_ERROR;
}
if (mp_cmp(should->dp.prime, is->dp.prime) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->dp.A, is->dp.A) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->dp.B, is->dp.B) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->dp.order, is->dp.order) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->dp.base.x, is->dp.base.x) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->dp.base.y, is->dp.base.y) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->pubkey.x, is->pubkey.x) != LTC_MP_EQ) return CRYPT_ERROR;
if (mp_cmp(should->pubkey.y, is->pubkey.y) != LTC_MP_EQ) return CRYPT_ERROR;
if (should->dp.size != is->dp.size) return CRYPT_ERROR;
if (should->dp.cofactor != is->dp.cofactor) return CRYPT_ERROR;
return CRYPT_OK;
}
static int s_ecc_new_api(void)
2017-12-19 12:31:50 +00:00
{
int i, j, stat;
const ltc_ecc_curve* dp;
ecc_key key, privkey, pubkey;
unsigned char buf[1000];
unsigned long len;
unsigned char data16[16] = { 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 };
unsigned long len16;
for (i = 0; i < (int)(sizeof(curvenames)/sizeof(curvenames[0])); i++) {
DO(ecc_find_curve(curvenames[i], &dp));
2017-12-19 12:31:50 +00:00
/* make new key */
DO(ecc_make_key_ex(&yarrow_prng, find_prng ("yarrow"), &key, dp));
len = sizeof(buf);
DO(ecc_export(buf, &len, PK_PRIVATE, &key));
DO(ecc_import_ex(buf, len, &privkey, dp));
ecc_free(&privkey);
len = sizeof(buf);
DO(ecc_export(buf, &len, PK_PUBLIC, &key));
DO(ecc_import_ex(buf, len, &pubkey, dp));
ecc_free(&pubkey);
len = sizeof(buf);
DO(ecc_ansi_x963_export(&key, buf, &len));
ecc_free(&key);
DO(ecc_ansi_x963_import_ex(buf, len, &pubkey, dp));
ecc_free(&pubkey);
/* generate new key */
DO(ecc_set_curve(dp, &key));
2017-12-19 12:31:50 +00:00
DO(ecc_generate_key(&yarrow_prng, find_prng ("yarrow"), &key));
len = sizeof(buf);
DO(ecc_get_key(buf, &len, PK_PRIVATE, &key));
ecc_free(&key);
/* load exported private key */
DO(ecc_set_curve(dp, &privkey));
2017-12-19 12:31:50 +00:00
DO(ecc_set_key(buf, len, PK_PRIVATE, &privkey));
if (strcmp(ltc_mp.name, "TomsFastMath") != 0) {
/* XXX-FIXME: TFM does not support sqrtmod_prime */
/* export compressed public key */
len = sizeof(buf);
DO(ecc_get_key(buf, &len, PK_PUBLIC|PK_COMPRESSED, &privkey));
if (len != 1 + (unsigned)ecc_get_size(&privkey)) return CRYPT_FAIL_TESTVECTOR;
/* load exported public+compressed key */
DO(ecc_set_curve(dp, &pubkey));
DO(ecc_set_key(buf, len, PK_PUBLIC, &pubkey));
ecc_free(&pubkey);
}
2017-12-19 12:31:50 +00:00
/* export long public key */
len = sizeof(buf);
DO(ecc_get_key(buf, &len, PK_PUBLIC, &privkey));
if (len != 1 + 2 * (unsigned)ecc_get_size(&privkey)) return CRYPT_FAIL_TESTVECTOR;
/* load exported public key */
DO(ecc_set_curve(dp, &pubkey));
2017-12-19 12:31:50 +00:00
DO(ecc_set_key(buf, len, PK_PUBLIC, &pubkey));
/* test signature */
len = sizeof(buf);
DO(ecc_sign_hash(data16, 16, buf, &len, &yarrow_prng, find_prng ("yarrow"), &privkey));
stat = 0;
DO(ecc_verify_hash(buf, len, data16, 16, &stat, &pubkey));
if (stat != 1) return CRYPT_FAIL_TESTVECTOR;
#ifdef LTC_SSH
/* test SSH+ECDSA/RFC5656 signature */
len = sizeof(buf);
DO(ecc_sign_hash_ex(data16, 16, buf, &len, &yarrow_prng, find_prng ("yarrow"),
LTC_ECCSIG_RFC5656, NULL, &privkey));
stat = 0;
DO(ecc_verify_hash_ex(buf, len, data16, 16, LTC_ECCSIG_RFC5656, &stat, &pubkey));
if (stat != 1) return CRYPT_FAIL_TESTVECTOR;
#endif
#ifdef LTC_ECC_SHAMIR
if (strcmp(ltc_mp.name, "TomsFastMath") != 0) {
/* XXX-FIXME: TFM does not support sqrtmod_prime */
int found = 0;
ecc_key reckey;
/* test recovery */
len = sizeof(buf);
DO(ecc_sign_hash(data16, 16, buf, &len, &yarrow_prng, find_prng ("yarrow"), &privkey));
DO(ecc_set_curve(dp, &reckey));
for (j = 0; j < 2*(1+(int)privkey.dp.cofactor); j++) {
stat = ecc_recover_key(buf, len, data16, 16, j, LTC_ECCSIG_ANSIX962, &reckey);
if (stat != CRYPT_OK) continue; /* last two will almost always fail, only possible if x<(prime mod order) */
stat = s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey);
if (stat == CRYPT_OK) found++;
}
if (found != 1) return CRYPT_FAIL_TESTVECTOR; /* unique match */
ecc_free(&reckey);
}
#endif
2017-12-19 12:31:50 +00:00
/* test encryption */
len = sizeof(buf);
DO(ecc_encrypt_key(data16, 16, buf, &len, &yarrow_prng, find_prng("yarrow"), find_hash("sha256"), &pubkey));
zeromem(data16, 16);
len16 = 16;
DO(ecc_decrypt_key(buf, len, data16, &len16, &privkey));
if (len16 != 16) return CRYPT_FAIL_TESTVECTOR;
for (j = 0; j < 16; j++) if (data16[j] != 0xd1) return CRYPT_FAIL_TESTVECTOR;
/* cleanup */
ecc_free(&privkey);
ecc_free(&pubkey);
}
return CRYPT_OK;
}
2004-10-30 03:00:26 +00:00
static int s_ecc_import_export(void) {
2017-12-30 21:30:36 +00:00
const ltc_ecc_curve *cu;
ecc_key key, pri, pub;
unsigned char out[300];
unsigned long outlen;
/* the following test keys were generated by:
# no password
openssl ecparam -name secp256k1 -genkey -out main-key.pem
openssl ec -in main-key.pem -param_enc explicit -out long_pri.der -outform DER
openssl ec -in main-key.pem -param_enc explicit -conv_form compressed -out long_pric.der -outform DER
openssl ec -in main-key.pem -param_enc explicit -pubout -out long_pub.der -outform DER
openssl ec -in main-key.pem -param_enc explicit -pubout -conv_form compressed -out long_pubc.der -outform DER
openssl ec -in main-key.pem -param_enc named_curve -out short_pri.der -outform DER
openssl ec -in main-key.pem -param_enc named_curve -conv_form compressed -out short_pric.der -outform DER
openssl ec -in main-key.pem -param_enc named_curve -pubout -out short_pub.der -outform DER
openssl ec -in main-key.pem -param_enc named_curve -pubout -conv_form compressed -out short_pubc.der -outform DER
# X.509 EC certificates
openssl req -new -x509 -keyform der -key long_pri.der -sha512 -subj '/CN=Test Cert EC' -out x509_cert_long.der -outform der -days 365000
openssl req -new -x509 -keyform der -key long_pric.der -sha512 -subj '/CN=Test Cert EC' -out x509_cert_longc.der -outform der -days 365000
openssl req -new -x509 -keyform der -key short_pri.der -sha512 -subj '/CN=Test Cert EC' -out x509_cert_short.der -outform der -days 365000
openssl req -new -x509 -keyform der -key short_pric.der -sha512 -subj '/CN=Test Cert EC' -out x509_cert_shortc.der -outform der -days 365000
2018-06-07 19:49:41 +00:00
# pkcs8 without password
openssl pkcs8 -topk8 -inform DER -outform DER -nocrypt -in long_pri.der -out long_pri_pkcs8.der
openssl pkcs8 -topk8 -inform DER -outform DER -nocrypt -in long_pric.der -out long_pric_pkcs8.der
openssl pkcs8 -topk8 -inform DER -outform DER -nocrypt -in short_pri.der -out short_pri_pkcs8.der
openssl pkcs8 -topk8 -inform DER -outform DER -nocrypt -in short_pric.der -out short_pric_pkcs8.der
# password protected - PBES1
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD2-DES -out long_pri_pkcs8_pbe_md2_des.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD2-RC2-64 -out long_pri_pkcs8_pbe_md2_rc2_64.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD5-DES -out long_pri_pkcs8_pbe_md5_des.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-SHA1-RC2-64 -out long_pri_pkcs8_pbe_sha1_rc2_64.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-MD5-RC2-64 -out long_pri_pkcs8_pbe_md5_rc2_64.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v1 PBE-SHA1-DES -out long_pri_pkcs8_pbe_sha1_des.der
# password protected - PBES2
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 rc2 -out long_pri_pkcs8_pbkdf2_rc2_cbc.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des -out long_pri_pkcs8_pbkdf2_des_cbc.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -out long_pri_pkcs8_pbkdf2_des_ede3_cbc.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA224 -out long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA256 -out long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA384 -out long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc.der
openssl pkcs8 -topk8 -inform DER -outform DER -passout pass:secret -in long_pri.der -v2 des3 -v2prf hmacWithSHA512 -out long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc.der
2017-12-30 21:30:36 +00:00
*/
static const unsigned char long_pri[] = { /* private + long public, explicit curve params */
0x30, 0x82, 0x01, 0x13, 0x02, 0x01, 0x01, 0x04, 0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91,
0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d,
0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23, 0xa0, 0x81, 0xa5, 0x30, 0x81, 0xa2, 0x02,
0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f,
0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x41, 0x04, 0x79, 0xbe, 0x66, 0x7e, 0xf9,
0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d,
0xce, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x48, 0x3a, 0xda, 0x77, 0x26,
0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0e, 0x11, 0x08, 0xa8, 0xfd, 0x17, 0xb4, 0x48, 0xa6,
0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8, 0x02, 0x21, 0x00, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xba, 0xae,
0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01,
0x01, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1,
0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5,
0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a, 0xb7,
0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e,
0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d
};
2018-06-07 19:49:41 +00:00
static const unsigned char long_pri_pkcs8[] = { /* private + long public, explicit curve params, PKCS8 */
0x30, 0x82, 0x01, 0x23, 0x02, 0x01, 0x00, 0x30, 0x81, 0xae, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce,
0x3d, 0x02, 0x01, 0x30, 0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48,
0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04,
0x41, 0x04, 0x79, 0xbe, 0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 0xb7,
0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e,
0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d
};
#if defined(LTC_MD2) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbe_md2_des[] = {
0x30, 0x82, 0x01, 0x49, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x01, 0x30, 0x0e, 0x04, 0x08, 0xd8, 0x1c, 0x80, 0xac, 0xd9, 0xfa, 0x9d, 0xbc, 0x02, 0x02, 0x08,
0x00, 0x04, 0x82, 0x01, 0x28, 0xe1, 0xd5, 0xa8, 0x9a, 0xa8, 0x23, 0x85, 0x53, 0x18, 0xb3, 0x96,
0x67, 0x8d, 0x45, 0x72, 0xf8, 0x69, 0xc4, 0xb1, 0x01, 0x3e, 0x04, 0xf7, 0xf7, 0x5d, 0x07, 0xad,
0xec, 0x8e, 0xd6, 0x23, 0x00, 0xe7, 0x59, 0xb0, 0x98, 0xbb, 0xdb, 0x85, 0xdb, 0x59, 0x4d, 0xb5,
0x53, 0xb3, 0x32, 0x50, 0x66, 0x75, 0xc4, 0x69, 0x05, 0x07, 0xee, 0xd4, 0xd8, 0x33, 0xcd, 0x4c,
0x94, 0xad, 0x82, 0xc7, 0x89, 0x53, 0x65, 0x9f, 0x55, 0x44, 0x95, 0x20, 0xe8, 0x4a, 0xc2, 0xef,
0x41, 0xf2, 0x9d, 0xf8, 0x3d, 0x16, 0x8a, 0x6a, 0x4e, 0x85, 0x90, 0xa7, 0xf9, 0xf8, 0xac, 0x16,
0x76, 0xf2, 0x29, 0x4b, 0x93, 0xec, 0xd8, 0x17, 0x3f, 0x89, 0x84, 0x79, 0x75, 0x90, 0x5f, 0xc3,
0xf2, 0xb8, 0x1a, 0x0a, 0x25, 0xf4, 0xe2, 0x59, 0xe0, 0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ined(LTC_RC2)
static const unsigned char long_pri_pkcs8_pbe_md2_rc2_64[] = {
0x30, 0x82, 0x01, 0x49, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x04, 0x30, 0x0e, 0x04, 0x08, 0xa2, 0x28, 0xb7, 0x2a, 0x08, 0x1c, 0x4a, 0xc4, 0x02, 0x02, 0x08,
0x00, 0x04, 0x82, 0x01, 0x28, 0x78, 0x12, 0x02, 0x58, 0x9b, 0xea, 0x77, 0xba, 0x84, 0x20, 0x96,
0x63, 0xf0, 0xf3, 0x38, 0x0b, 0x98, 0x53, 0x63, 0x8d, 0xa4, 0x5a, 0xa0, 0xa9, 0x21, 0x93, 0xd0,
0x56, 0xc9, 0xd2, 0x67, 0xb2, 0x5e, 0xb5, 0x9f, 0x15, 0x8c, 0x3c, 0x9a, 0xaf, 0x9c, 0xe5, 0x8b,
0xe6, 0x61, 0xac, 0xa4, 0x26, 0x75, 0x96, 0xea, 0x73, 0xaf, 0xd6, 0xb7, 0x4c, 0x66, 0x33, 0x98,
0x9e, 0x0b, 0xf8, 0xe6, 0x9c, 0xfd, 0x83, 0x0f, 0x55, 0x86, 0x9f, 0xa9, 0xf0, 0x23, 0xcb, 0x80,
0xe5, 0x32, 0x50, 0xea, 0x5b, 0x7d, 0xe2, 0x69, 0xc4, 0x6b, 0x61, 0xb2, 0xb8, 0x81, 0xe9, 0x05,
0xcb, 0x76, 0xae, 0xa5, 0x37, 0x0f, 0x3c, 0xe6, 0xde, 0x24, 0x6a, 0x9c, 0xf2, 0x0a, 0x28, 0x6a,
0xc9, 0xec, 0xef, 0xd7, 0xda, 0xcc, 0xf4, 0x3b, 0x74, 0x36, 0xc5, 0xaf, 0x53, 0xd8, 0xf4, 0x30,
0x0b, 0xd4, 0xb6, 0x36, 0xdc, 0x90, 0x4f, 0x83, 0x44, 0x79, 0xea, 0xc9, 0xb7, 0xb2, 0xd0, 0x03,
0xa6, 0x63, 0x7e, 0x1d, 0xa8, 0x4e, 0x93, 0x16, 0x7a, 0x4f, 0xd2, 0x8b, 0xd6, 0x78, 0x7d, 0x48,
0x41, 0x7c, 0xba, 0xc3, 0x64, 0x6f, 0x11, 0x22, 0x6d, 0x40, 0xb8, 0xc9, 0x03, 0x7a, 0x2c, 0xdf,
0x76, 0x78, 0x4f, 0x5f, 0x50, 0x03, 0x7a, 0xaf, 0x78, 0x91, 0xbb, 0x2a, 0xe6, 0x5e, 0x0f, 0xf5,
0x60, 0x9e, 0x8a, 0x2f, 0xdb, 0x9e, 0x57, 0xbe, 0xf6, 0x0f, 0x76, 0x6e, 0x44, 0x91, 0x7b, 0x36,
0x88, 0x9c, 0xf9, 0xbe, 0x13, 0x3e, 0x6b, 0x85, 0x62, 0xda, 0x1f, 0xf9, 0x73, 0x98, 0x8a, 0x0d,
0xdf, 0x11, 0x74, 0x18, 0xe1, 0x1c, 0xd1, 0x3f, 0x02, 0x43, 0xd4, 0x46, 0xe3, 0x8a, 0x3b, 0x6c,
0x7f, 0x81, 0xb4, 0xc3, 0x85, 0x4f, 0x89, 0x67, 0x26, 0x5a, 0x08, 0x35, 0x31, 0xd3, 0x15, 0xbb,
0xcc, 0x7d, 0x7b, 0x99, 0x41, 0xdb, 0x43, 0xa0, 0x83, 0x84, 0x74, 0x6c, 0x0a, 0x80, 0x46, 0xdc,
0xc8, 0x88, 0x87, 0x01, 0x21, 0x19, 0xd4, 0x1e, 0xf4, 0x09, 0x0e, 0x18, 0x31, 0x91, 0x37, 0x35,
0x1d, 0x07, 0xaf, 0x87, 0x92, 0x3d, 0xf8, 0xee, 0x6f, 0x87, 0x7b, 0x52, 0x3d
};
#endif
#if defined(LTC_MD5) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbe_md5_des[] = {
0x30, 0x82, 0x01, 0x49, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x03, 0x30, 0x0e, 0x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xe8, 0x73, 0xca, 0xc3,
0x87, 0x62, 0xa9, 0x0e, 0xef, 0xcf, 0x73, 0x3c, 0xb3, 0xa0, 0x1b, 0xb5, 0x5d, 0x72, 0x89, 0x82,
0xd4, 0xf6, 0x37, 0x0b, 0x57, 0x8f, 0x48, 0xd4, 0xf1, 0x10, 0xa1, 0xe5, 0x25, 0x90, 0xeb, 0xde,
0x8d, 0x2a, 0x9d, 0xfb, 0x7c, 0x0d, 0xdc, 0x38, 0x45, 0x9e, 0xa0, 0x05, 0x98, 0x4e, 0x72, 0x9f,
0x3d, 0xde, 0xc7, 0x00, 0xf9, 0xaf, 0xdc, 0x67, 0x47, 0x73, 0xf7, 0xcf, 0x63, 0x80, 0xe3, 0x05,
0xb3, 0xda, 0x9f, 0x4b, 0x27, 0xd3, 0x14, 0xc9, 0x62, 0xd5, 0x09, 0xde, 0x4d, 0xe7, 0x21, 0x67,
0xfa, 0x10, 0x34, 0x18, 0xbf, 0xde, 0xf7, 0x95, 0x25, 0x6d, 0xba, 0xe4, 0x10, 0xf0, 0x9d, 0x05,
0x7b, 0xe4, 0xb5, 0xc0, 0x21, 0xb3, 0x7d, 0xcd, 0x1d, 0x80, 0xd0, 0x10, 0xd4, 0xdb, 0x9f, 0x06,
0xd5, 0x86, 0xea, 0x62, 0x96, 0xb7, 0x31, 0x73, 0xde, 0x25, 0xd0, 0xbb, 0xb2
};
#endif
#if defined(LTC_MD5) && defined(LTC_RC2)
static const unsigned char long_pri_pkcs8_pbe_md5_rc2_64[] = {
0x30, 0x82, 0x01, 0x49, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x06, 0x30, 0x0e, 0x04, 0x08, 0x95, 0x82, 0x6d, 0x08, 0xe4, 0x7e, 0xae, 0x5f, 0x02, 0x02, 0x08,
0x00, 0x04, 0x82, 0x01, 0x28, 0x93, 0x2c, 0xd8, 0x27, 0xed, 0x13, 0xe1, 0x31, 0xef, 0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 0x9d, 0x6f, 0x93, 0x9c, 0x87, 0x99, 0xd1, 0x1c, 0x93, 0x0c, 0xbb, 0xf9,
0x70, 0x36, 0x28, 0x56, 0x68, 0x27, 0x2f, 0x1e, 0xf1, 0x86, 0x0a, 0x23, 0x04, 0xe6, 0x72, 0x1f,
0x1b, 0x71, 0x45, 0x0b, 0xe7, 0x74, 0x45, 0x8e, 0x7f, 0x94, 0xbc, 0xcd, 0x6c, 0xf8, 0xf3, 0xed,
0x44, 0x02, 0x4d, 0x0a, 0xdd, 0xe9, 0xe4, 0x46, 0x31, 0x94, 0x28, 0x9b, 0x5f, 0x05, 0x37, 0xf4,
0x05, 0x9c, 0xa3, 0x9c, 0xdf, 0xb7, 0xfb, 0xab, 0xe0, 0x07, 0x26, 0x40, 0x79, 0x12, 0x9a, 0x78,
0xf6, 0xb6, 0x30, 0x3d, 0x4e, 0x16, 0x2e, 0x39, 0x96, 0x98, 0x2a, 0x8c, 0xa7, 0xdb, 0xa0, 0x4a,
0x3f, 0x42, 0x30, 0xd3, 0x5d, 0xd0, 0x26, 0xd0, 0xc5, 0xd5, 0xa4, 0x10, 0x10
};
#endif
#if defined(LTC_SHA1) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbe_sha1_des[] = {
0x30, 0x82, 0x01, 0x49, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0a, 0x30, 0x0e, 0x04, 0x08, 0x7c, 0x01, 0xae, 0xc9, 0x05, 0x43, 0x40, 0x70, 0x02, 0x02, 0x08,
0x00, 0x04, 0x82, 0x01, 0x28, 0xff, 0x96, 0x47, 0x56, 0x02, 0xd5, 0xd3, 0x2a, 0xf0, 0x44, 0x47,
0x7e, 0x74, 0x28, 0x62, 0x3f, 0x2b, 0xd4, 0xa9, 0xcc, 0x2c, 0xb7, 0x03, 0xc7, 0xa6, 0x39, 0xde,
0xc1, 0x46, 0xf1, 0xcd, 0x53, 0xb8, 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 0xe5, 0xbc,
0x5e, 0xc4, 0x60, 0xe9, 0xd4, 0xc6, 0xf2, 0x60, 0xf3, 0xcd, 0x36, 0xa4, 0xe4, 0x6c, 0xfe, 0xbf,
0xab, 0xd5, 0x2f, 0x12, 0xf4, 0xa2, 0xf0, 0xeb, 0x10, 0xd9, 0x74, 0xef, 0x7c, 0x37, 0x8d, 0xdd,
0xc1, 0xaa, 0x84, 0xf6, 0xf1, 0xb6, 0x5b, 0x43, 0x51, 0x06, 0x78, 0xae, 0x8e, 0x9d, 0xc5, 0xc9,
0x26, 0xdc, 0x05, 0xa3, 0x00, 0xfa, 0x4a, 0x27, 0x5f, 0x19, 0xf3, 0x88, 0x2e, 0x01, 0xb8, 0xe7,
0x23, 0x37, 0x77, 0xa1, 0xbb, 0xb0, 0x66, 0xe2, 0xba, 0x10, 0x50, 0x06, 0x65
};
#endif
#if defined(LTC_SHA1) && defined(LTC_RC2)
static const unsigned char long_pri_pkcs8_pbe_sha1_rc2_64[] = {
0x30, 0x82, 0x01, 0x49, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0b, 0x30, 0x0e, 0x04, 0x08, 0x64, 0x3c, 0xdb, 0x86, 0xd9, 0xa0, 0xae, 0x3e, 0x02, 0x02, 0x08,
0x00, 0x04, 0x82, 0x01, 0x28, 0x78, 0x85, 0x55, 0x7f, 0x37, 0xb8, 0xf7, 0xff, 0x94, 0x94, 0xf3,
0xf2, 0x21, 0x05, 0x6d, 0x75, 0xca, 0x03, 0x1c, 0xa3, 0x9f, 0x47, 0x41, 0x14, 0x57, 0xdd, 0x63,
0x71, 0x6c, 0xc2, 0x51, 0x14, 0x4a, 0x0d, 0x63, 0x12, 0xa8, 0x27, 0xf6, 0x3c, 0xb7, 0x47, 0x6d,
0xa0, 0x72, 0xfe, 0x60, 0x9f, 0x1c, 0xc8, 0xe4, 0xe5, 0xfe, 0x68, 0x9d, 0x85, 0x0f, 0x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70, 0xdf, 0x14, 0x83, 0xbe, 0xd8, 0x37, 0xfa, 0x8b, 0x14, 0xdb,
0x0c, 0x4e, 0x98, 0xc7, 0xe6, 0x40, 0x38, 0x94, 0x69, 0xd4, 0xd4, 0xa9, 0xb5, 0x3f, 0xec, 0xac,
0x14, 0x59, 0x46, 0xb5, 0x98, 0xb0, 0x99, 0x89, 0xea, 0xf5, 0x43, 0xb4, 0x47, 0xa9, 0xb1, 0xf2,
0x03, 0x2a, 0xaf, 0xd5, 0x5d, 0x81, 0xae, 0x3b, 0xb4, 0x52, 0x11, 0x85, 0xcb
};
#endif
#if defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbkdf2_des_cbc[] = {
0x30, 0x82, 0x01, 0x6b, 0x30, 0x3d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x30, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x0e, 0x04, 0x08, 0xda, 0x6b, 0x0a, 0x58, 0x7e, 0xd2, 0x9d, 0x38, 0x02, 0x02, 0x08, 0x00,
0x30, 0x11, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x07, 0x04, 0x08, 0xcc, 0x5c, 0x19, 0x7c, 0xa6,
0x0d, 0x01, 0x4b, 0x04, 0x82, 0x01, 0x28, 0x02, 0x9d, 0xec, 0xa4, 0xe1, 0x42, 0xc4, 0xdb, 0x18,
0x32, 0x26, 0x96, 0x8b, 0x87, 0x1a, 0xb7, 0x66, 0x8e, 0xfd, 0x23, 0x1e, 0x1e, 0x20, 0x18, 0xcd,
0x81, 0x1b, 0x67, 0x86, 0x78, 0xae, 0xb3, 0x70, 0x81, 0xf9, 0x6a, 0x26, 0x4e, 0x31, 0x64, 0xf8,
0x7e, 0xbf, 0xf3, 0xd3, 0xea, 0x7c, 0xda, 0x5d, 0x4d, 0xb7, 0x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1c, 0x6b, 0x4a, 0x0c, 0xc6, 0x46, 0x61, 0x92, 0x1c, 0x01, 0x11, 0xbc, 0x55, 0xdd,
0x82, 0xd1, 0xbf, 0x2e, 0x1e, 0x97, 0xbe, 0xa7, 0x6e, 0x5a, 0xcd, 0xc6, 0x8f, 0x38, 0x24, 0x8f,
0xb8, 0x36, 0x3d, 0x06, 0x82, 0x14, 0x5b, 0x1a, 0x84, 0x1e, 0x47, 0x53, 0x3a, 0x12, 0x21, 0x23,
0xbe, 0xe4, 0xf4, 0x57, 0xc7, 0x31, 0x45, 0x24, 0x46, 0x94, 0x53, 0x0b, 0x1d, 0xcd, 0x57
};
#endif
#if defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbkdf2_des_ede3_cbc[] = {
0x30, 0x82, 0x01, 0x6e, 0x30, 0x40, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x33, 0x30, 0x1b, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x0e, 0x04, 0x08, 0x6a, 0x99, 0x55, 0x06, 0x40, 0xd5, 0xe6, 0xc9, 0x02, 0x02, 0x08, 0x00,
0x30, 0x14, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x03, 0x07, 0x04, 0x08, 0x7f, 0xf2,
0xa7, 0xa3, 0x2c, 0xbb, 0x8e, 0x78, 0x04, 0x82, 0x01, 0x28, 0x55, 0x4d, 0xcb, 0xab, 0xb8, 0x6e,
0xcf, 0x00, 0xd2, 0xe8, 0x1e, 0x0e, 0xe1, 0x8f, 0x51, 0x8e, 0x32, 0x68, 0xaf, 0x44, 0xa6, 0xf2,
0x9e, 0x11, 0xd7, 0x0f, 0xa7, 0xd5, 0x74, 0x77, 0xbc, 0x6b, 0x53, 0x40, 0x70, 0xb6, 0x02, 0xdb,
0xa6, 0x2e, 0xc7, 0x20,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 0x05, 0x3c, 0x40, 0x69,
0x97, 0x0a, 0x4c, 0x45, 0xae, 0x38, 0x22, 0xc5, 0x95, 0xf2, 0x4f, 0x0c, 0xd5, 0x54, 0x23, 0x92,
0x9b, 0x06, 0x81, 0xca, 0xa5, 0x1e, 0x91, 0x7e, 0x2b, 0x85, 0xb4, 0xd4, 0xeb, 0xb6, 0xee, 0x22,
0x10, 0x72, 0xaf, 0x9e, 0x6d, 0xcc, 0x16, 0x24, 0x01, 0x44, 0x48, 0xaa, 0xc9, 0xf8, 0x38, 0x72,
0x7a, 0x35, 0x94, 0x20, 0x58, 0xa2, 0x1c, 0x81, 0xaf, 0x47, 0x3b, 0xb8, 0x23, 0xbb, 0x71, 0x09,
0xbf, 0x93
};
#endif
#if defined(LTC_RC2)
static const unsigned char long_pri_pkcs8_pbkdf2_rc2_cbc[] = {
0x30, 0x82, 0x01, 0x76, 0x30, 0x48, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x3b, 0x30, 0x1e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x11, 0x04, 0x08, 0xbf, 0xef, 0x1a, 0x42, 0x5d, 0xc3, 0x6b, 0x0f, 0x02, 0x02, 0x08, 0x00,
0x02, 0x01, 0x10, 0x30, 0x19, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x03, 0x02, 0x30,
0x0d, 0x02, 0x01, 0x3a, 0x04, 0x08, 0xfe, 0xf2, 0x09, 0x0c, 0xa4, 0xd0, 0xe6, 0x83, 0x04, 0x82,
0x01, 0x28, 0x61, 0x18, 0x73, 0xb7, 0x9d, 0x58, 0xc8, 0x4a, 0xf4, 0x24, 0xec, 0xb4, 0xe6, 0x24,
0xa7, 0xf0, 0x1e, 0xea, 0xc3, 0x57, 0x44, 0xb7, 0x5a, 0x77, 0xe5, 0x3c, 0x1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9f, 0x25, 0x19, 0x89, 0x19, 0xe6, 0x8d, 0x64, 0x31, 0x38, 0x68,
0xfa, 0x40, 0x84, 0xca, 0x39, 0xef, 0x1a, 0x4a, 0xe9, 0x04, 0xee, 0xcc, 0x4a, 0xea, 0x19, 0x96,
0xa4, 0xcd, 0x62, 0x76, 0xb3, 0xc4, 0x2c, 0x23, 0x75, 0x24, 0xcd, 0x49, 0xe2, 0x17, 0x81, 0x45,
0x24, 0x55, 0xeb, 0xe1, 0xb4, 0xeb, 0xda, 0xc5, 0x56, 0xac, 0xfa, 0x30, 0xbd, 0x05, 0xbb, 0x03,
0x65, 0x50, 0xdc, 0xbf, 0xdf, 0xff, 0x2a, 0x80, 0x85, 0x6d, 0x6a, 0x5c, 0x93, 0xb8, 0x81, 0xc4,
0xca, 0x91, 0x08, 0x7b, 0x8a, 0x9d, 0xe9, 0x2d, 0xfc, 0x3b
};
#endif
#if defined(LTC_SHA224) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc[] = {
0x30, 0x82, 0x01, 0x7c, 0x30, 0x4e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x41, 0x30, 0x29, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x1c, 0x04, 0x08, 0xb2, 0x82, 0x71, 0xc5, 0xd6, 0x3c, 0x2b, 0x92, 0x02, 0x02, 0x08, 0x00,
0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x08, 0x05, 0x00, 0x30, 0x14,
0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x03, 0x07, 0x04, 0x08, 0x4a, 0x46, 0x2a, 0xa9,
0xd5, 0x9f, 0x79, 0xea, 0x04, 0x82, 0x01, 0x28, 0xc4, 0x27, 0x05, 0xa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0xf6, 0x4d, 0x40, 0x4e, 0xf1, 0xec, 0x72, 0xec, 0x3c, 0xb1, 0x87, 0x44,
0xe9, 0x72, 0xc5, 0x8b, 0x48, 0xd9, 0x98, 0x08, 0x55, 0xc5, 0x40, 0x26, 0xf5, 0x8d, 0x73, 0x5e,
0x35, 0x98, 0x71, 0x09, 0x98, 0xfa, 0xb7, 0x1c, 0x35, 0xcd, 0xd4, 0xf1, 0x65, 0xb4, 0x59, 0xdb,
0x9e, 0x79, 0xe7, 0x21, 0x99, 0xd7, 0x9e, 0x8c, 0x13, 0x77, 0x0c, 0x5e, 0xae, 0x43, 0x82, 0xf1,
0x83, 0x79, 0x7d, 0x37, 0x51, 0xde, 0x65, 0x26, 0x1f, 0x8f, 0x81, 0x1c, 0x55, 0x40, 0xec, 0xaf,
0x3f, 0x0a, 0x68, 0xd2, 0xc7, 0x59, 0x47, 0xda, 0x78, 0x0c, 0x0e, 0x59, 0x6a, 0x93, 0xcd, 0x05,
0x09, 0x51, 0x47, 0xb1, 0x45, 0x3f, 0x67, 0xf8, 0x76, 0x50, 0x76, 0xa3, 0x2d, 0x31, 0x17, 0x73
};
#endif
#if defined(LTC_SHA256) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc[] = {
0x30, 0x82, 0x01, 0x7c, 0x30, 0x4e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x41, 0x30, 0x29, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x1c, 0x04, 0x08, 0x93, 0x6e, 0x0a, 0x02, 0x8e, 0x72, 0xac, 0x98, 0x02, 0x02, 0x08, 0x00,
0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x09, 0x05, 0x00, 0x30, 0x14,
0x06, 0x08, 0x2a, 0x86, 0x48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 0x79,
0xee, 0x4c, 0x08, 0x3a, 0xd6, 0x35, 0x9b, 0xc9, 0xff, 0xd8, 0x41, 0x41, 0xd1, 0xc6, 0xa1, 0xba,
0x4d, 0xc6, 0xb7, 0x85, 0x05, 0xa1, 0x8e, 0xeb, 0xd1, 0xd2, 0x3a, 0x13, 0xd7, 0xbd, 0xb0, 0x02,
0xfe, 0x54, 0xfe, 0xf4, 0xfd, 0x31, 0x0c, 0x42, 0x78, 0xb9, 0x17, 0x90, 0x36, 0x17, 0xb8, 0x1a,
0x08, 0xe8, 0x7e, 0x5f, 0xbb, 0x30, 0xc2, 0xec, 0xd5, 0x08, 0xbc, 0xae, 0x2f, 0xe0, 0xca, 0xf2,
0x44, 0x2c, 0xa4, 0xb5, 0xec, 0xb9, 0xc2, 0xa3, 0x4a, 0x1a, 0x49, 0xfb, 0x3e, 0x5c, 0xb5, 0xd8,
0xb6, 0xf0, 0xbc, 0xa2, 0xda, 0xaa, 0x7a, 0x05, 0x4d, 0x06, 0xc0, 0x4b, 0x8f, 0x59, 0xce, 0x56,
0x02, 0x26, 0xb2, 0xa0, 0x5f, 0x74, 0xbb, 0x0b, 0x01, 0x1c, 0xb2, 0x0b, 0x8a, 0x80, 0xa4, 0x5d,
0x6e, 0x52, 0x24, 0xd0, 0xbe, 0xf5, 0x8e, 0x9e, 0x9e, 0x02, 0x40, 0x08, 0x99, 0xe0, 0x2c, 0xf9
};
#endif
#if defined(LTC_SHA384) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc[] = {
0x30, 0x82, 0x01, 0x7c, 0x30, 0x4e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x41, 0x30, 0x29, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x1c, 0x04, 0x08, 0xfd, 0x6c, 0xdf, 0x0b, 0x23, 0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 0x66, 0x54, 0xa2, 0xce, 0x77, 0x19, 0x7e, 0xdd, 0xf7, 0x4d, 0xdc,
0xb1, 0xf7, 0xbf, 0x3c, 0xb5, 0xd2, 0x30, 0x9d, 0x3c, 0x35, 0x09, 0x37, 0xae, 0xae, 0x0f, 0x0b,
0x9d, 0xf5, 0x10, 0xae, 0x56, 0x83, 0x4f, 0xd8, 0xcd, 0xfe, 0xb7, 0xa9, 0x54, 0xf9, 0xb3, 0x89,
0xf6, 0x9a, 0x11, 0x60, 0x04, 0x4d, 0x80, 0xaf, 0x74, 0x73, 0x2d, 0xc4, 0x24, 0x23, 0xaa, 0x50,
0x4c, 0xf1, 0xd6, 0x2d, 0xc6, 0x74, 0xeb, 0x62, 0x02, 0xda, 0x81, 0x68, 0xc8, 0x68, 0xf0, 0x82,
0x71, 0xb2, 0xa5, 0x8e, 0x45, 0x93, 0x29, 0x94, 0x8f, 0xec, 0x11, 0x65, 0xcc, 0xd6, 0x4c, 0x2e,
0x0d, 0x4e, 0x45, 0xb4, 0x4e, 0x97, 0x38, 0xd0, 0xc2, 0x61, 0x43, 0x78, 0xa4, 0x08, 0x0a, 0x58,
0x3f, 0x66, 0xdb, 0x34, 0x42, 0x17, 0x42, 0x92, 0x04, 0x9a, 0x2d, 0x73, 0xaf, 0x58, 0x38, 0xc8,
0x3f, 0x5b, 0x83, 0x95, 0x3d, 0xae, 0xae, 0x60, 0x2b, 0x6d, 0xd9, 0xb4, 0xe3, 0x97, 0x6b, 0x49,
0xef, 0xd9, 0x68, 0xbb, 0x8d, 0x3a, 0x7e, 0xcb, 0x57, 0x33, 0xf5, 0x1a, 0x8d, 0xb4, 0x6d, 0xfb
};
#endif
#if defined(LTC_SHA512) && defined(LTC_DES)
static const unsigned char long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc[] = {
0x30, 0x82, 0x01, 0x7c, 0x30, 0x4e, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05,
0x0d, 0x30, 0x41, 0x30, 0x29, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x05, 0x0c,
0x30, 0x1c, 0x04, 0x08, 0xad, 0xb1, 0xe1, 0x21, 0xdc, 0xe5, 0x09, 0xee, 0x02, 0x02, 0x08, 0x00,
0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x02, 0x0b, 0x05, 0x00, 0x30, 0x14,
0x06, 0x08, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x03, 0x07, 0x04, 0x08, 0x1a, 0x8b, 0x81, 0x3b,
0x97, 0x7d, 0xfa, 0x51, 0x04, 0x82, 0x01, 0x28, 0x6d, 0x6f, 0x93, 0x77, 0xcb, 0x52, 0x2d, 0x3b,
0x82, 0x12, 0x80, 0xce, 0x9e, 0x69, 0x03, 0xe4, 0x64, 0xa1, 0x4b, 0x8e, 0x60, 0x51, 0x4d, 0x08,
0xe1, 0x25, 0x5d, 0xe6, 0xed, 0x20, 0x23, 0x4c, 0x4e, 0xa3, 0xe8, 0xab, 0x7a, 0xf8, 0x54, 0x65,
0x22, 0x92, 0x0c, 0x45, 0xab, 0x1c, 0xe2, 0x68, 0x4e, 0xf3, 0xa9, 0x61, 0xd6, 0x44, 0x9d, 0x55,
0x19, 0xc6, 0xd9, 0x2a, 0x0d, 0x45, 0x7d, 0xca, 0xa4, 0x41, 0xb5, 0x6d, 0xd5, 0x09, 0xf2, 0xb6,
0x81, 0x95, 0x64, 0xdb, 0x2b, 0xed, 0x83, 0x6b, 0x44, 0xa6, 0xce, 0x36, 0x8d, 0x23, 0x89, 0xb6,
0xf3, 0xb0, 0xe0, 0xcf, 0x57, 0x72, 0xc7, 0x61, 0x3f, 0x29, 0xb9, 0xea, 0xe8, 0x7a, 0xca, 0x43,
0x90, 0x79, 0x81, 0x8a, 0xe2, 0x3c, 0xd1, 0xa6, 0xd9, 0x09, 0xd8, 0x7d, 0xd0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unsigned char long_pric[] = { /* private + compressed public, explicit curve params */
0x30, 0x81, 0xd3, 0x02, 0x01, 0x01, 0x04, 0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b,
0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f,
0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23, 0xa0, 0x81, 0x85, 0x30, 0x81, 0x82, 0x02, 0x01,
0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, 0x30,
0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x21, 0x02, 0x79, 0xbe, 0x66, 0x7e, 0xf9, 0xdc,
0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xce,
0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xba, 0xae, 0xdc,
0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01,
0xa1, 0x24, 0x03, 0x22, 0x00, 0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf,
0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9,
0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16
};
2018-06-07 19:49:41 +00:00
static const unsigned char long_pric_pkcs8[] = { /* private + compressed public, explicit curve params, PKCS8 */
0x30, 0x81, 0xe3, 0x02, 0x01, 0x00, 0x30, 0x81, 0x8e, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x02, 0x01, 0x30, 0x81, 0x82, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce,
0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x21,
0x02, 0x79, 0xbe, 0x66, 0x7e, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b,
0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xce, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17,
0x98, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c,
0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0x04, 0x4d, 0x30, 0x4b, 0x02, 0x01, 0x01, 0x04, 0x20,
0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7,
0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23,
0xa1, 0x24, 0x03, 0x22, 0x00, 0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf,
0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9,
0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16
};
2017-12-30 21:30:36 +00:00
static const unsigned char long_pub[] = { /* long public, explicit curve params */
0x30, 0x81, 0xf5, 0x30, 0x81, 0xae, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x30,
0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01,
0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x41, 0x04, 0x79, 0xbe,
0x66, 0x7e, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b,
0xfc, 0xdb, 0x2d, 0xce, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x48, 0x3a,
0xda, 0x77, 0x26, 0xa3, 0xc4, 0x65, 0x5d, 0xa4, 0xfb, 0xfc, 0x0e, 0x11, 0x08, 0xa8, 0xfd, 0x17,
0xb4, 0x48, 0xa6, 0x85, 0x54, 0x19, 0x9c, 0x47, 0xd0, 0x8f, 0xfb, 0x10, 0xd4, 0xb8, 0x02, 0x21,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41,
0x41, 0x02, 0x01, 0x01, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e,
0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e,
0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a,
0xb7, 0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5,
0x6e, 0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d
};
static const unsigned char long_pubc[] = { /* compressed public, explicit curve params */
0x30, 0x81, 0xb5, 0x30, 0x81, 0x8e, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x30,
0x81, 0x82, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01,
0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff,
0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00, 0x04, 0x01, 0x07, 0x04, 0x21, 0x02, 0x79, 0xbe,
0x66, 0x7e, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0, 0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b,
0xfc, 0xdb, 0x2d, 0xce, 0x28, 0xd9, 0x59, 0xf2, 0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x02, 0x21,
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0, 0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41,
0x41, 0x02, 0x01, 0x01, 0x03, 0x22, 0x00, 0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e,
0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e,
0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16
};
static const unsigned char short_pri[] = { /* private + long public, curve by OID */
0x30, 0x74, 0x02, 0x01, 0x01, 0x04, 0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b, 0xba,
0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f, 0x5f,
0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23, 0xa0, 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x0a,
0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf,
0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9,
0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a, 0xb7, 0x6c,
0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e, 0x4b,
0x64, 0x37, 0x31, 0x24, 0x79, 0x4d
};
2018-06-07 19:49:41 +00:00
static const unsigned char short_pri_pkcs8[] = { /* private + long public, curve by OID, PKCS8 */
0x30, 0x81, 0x84, 0x02, 0x01, 0x00, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x0a, 0x04, 0x6d, 0x30, 0x6b, 0x02, 0x01, 0x01, 0x04,
0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2,
0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd,
0x23, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1,
0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5,
0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a, 0xb7,
0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e,
0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d
};
2017-12-30 21:30:36 +00:00
static const unsigned char short_pric[] = { /* private + compressed public, curve by OID */
0x30, 0x54, 0x02, 0x01, 0x01, 0x04, 0x20, 0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b, 0xba,
0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7, 0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f, 0x5f,
0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23, 0xa0, 0x07, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x0a,
0xa1, 0x24, 0x03, 0x22, 0x00, 0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf,
0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9,
0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16
};
2018-06-07 19:49:41 +00:00
static const unsigned char short_pric_pkcs8[] = { /* private + compressed public, curve by OID, PKCS8 */
0x30, 0x64, 0x02, 0x01, 0x00, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01,
0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x0a, 0x04, 0x4d, 0x30, 0x4b, 0x02, 0x01, 0x01, 0x04, 0x20,
0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7,
0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23,
0xa1, 0x24, 0x03, 0x22, 0x00, 0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf,
0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9,
0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16
};
2017-12-30 21:30:36 +00:00
static const unsigned char short_pub[] = { /* long public, curve by OID */
0x30, 0x56, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b,
0x81, 0x04, 0x00, 0x0a, 0x03, 0x42, 0x00, 0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e,
0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e,
0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a,
0xb7, 0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63, 0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5,
0x6e, 0x4b, 0x64, 0x37, 0x31, 0x24, 0x79, 0x4d
};
static const unsigned char short_pubc[] = { /* compressed public, curve by OID */
0x30, 0x36, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b,
0x81, 0x04, 0x00, 0x0a, 0x03, 0x22, 0x00, 0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e,
0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e,
0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16
};
static const unsigned char raw_pri[] = { /* raw private key */
0x0c, 0xf1, 0xad, 0x2f, 0x03, 0xf7, 0x91, 0x1b, 0xba, 0x03, 0xcf, 0x23, 0x37, 0xc8, 0xf2, 0xf7,
0x36, 0xce, 0x65, 0xf1, 0x84, 0x2d, 0x7d, 0x9f, 0x5f, 0x9e, 0x21, 0xd9, 0x5e, 0x49, 0xbd, 0x23
};
static const unsigned char raw_pub[] = { /* raw public key - long form */
0x04, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba,
0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5,
0x16, 0x91, 0xbd, 0xb2, 0xb9, 0x1b, 0x40, 0x10, 0x5a, 0xb7, 0x6c, 0x6e, 0x32, 0x5b, 0xf7, 0x63,
0x62, 0x94, 0x24, 0x24, 0xdb, 0xec, 0x3f, 0x8b, 0xe5, 0x6e, 0x4b, 0x64, 0x37, 0x31, 0x24, 0x79,
0x4d
};
static const unsigned char raw_pubc[] = { /* raw public key - compressed form */
0x03, 0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba,
0xb6, 0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5,
0x16
};
static const unsigned char x509_cert_long[] = { /* X.509 cert, long pubkey, explicit curve params */
0x30, 0x82, 0x02, 0x13, 0x30, 0x82, 0x01, 0xba, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00,
0xaf, 0x14, 0xe3, 0x53, 0x36, 0x06, 0x79, 0x34, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce,
0x3d, 0x04, 0x03, 0x04, 0x30, 0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
0x0c, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x20, 0x17,
0x0d, 0x31, 0x37, 0x31, 0x32, 0x33, 0x30, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x18, 0x0f,
0x33, 0x30, 0x31, 0x37, 0x30, 0x35, 0x30, 0x32, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x30,
0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0c, 0x54, 0x65, 0x73, 0x74,
0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x81, 0xf5, 0x30, 0x81, 0xae, 0x06, 0x07,
0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x30, 0x81, 0xa2, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06,
0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00,
0x04, 0x01, 0x07, 0x04, 0x41, 0x04, 0x79, 0xbe, 0x66, 0x7e, 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0xa3, 0x1c, 0x20, 0x61, 0xd2, 0xf3, 0xf5, 0xae, 0xa8, 0x85, 0x70,
0xf9, 0x1f, 0x2c, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
0x66, 0xc9, 0x90, 0x3c, 0x8a, 0x81, 0xa3, 0x1c, 0x20, 0x61, 0xd2, 0xf3, 0xf5, 0xae, 0xa8, 0x85,
0x70, 0xf9, 0x1f, 0x2c, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xff, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x04, 0x03, 0x47,
0x00, 0x30, 0x44, 0x02, 0x1f, 0x2a, 0x62, 0x64, 0x05, 0x67, 0xb0, 0x2c, 0xa0, 0xa3, 0xb8, 0x61,
0x4e, 0x87, 0x06, 0x69, 0xf2, 0xda, 0x78, 0xd6, 0x0e, 0x8d, 0x9b, 0xf1, 0x43, 0x5f, 0xf6, 0x40,
0x9d, 0x9d, 0xbd, 0xce, 0x02, 0x21, 0x00, 0xe9, 0x6f, 0x79, 0xb4, 0x4a, 0x00, 0xf7, 0xfa, 0x81,
0x25, 0x29, 0xec, 0x79, 0xb2, 0xfa, 0x86, 0xf8, 0x84, 0xd1, 0x78, 0xe7, 0xf8, 0xfd, 0x76, 0x2d,
0x4f, 0xfe, 0x02, 0x72, 0xba, 0x6c, 0xca
};
static const unsigned char x509_cert_longc[] = { /* X.509 cert, compressed pubkey, explicit curve params */
0x30, 0x82, 0x01, 0xd3, 0x30, 0x82, 0x01, 0x7a, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00,
0x90, 0x5b, 0x48, 0x32, 0x37, 0x4b, 0x72, 0x54, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce,
0x3d, 0x04, 0x03, 0x04, 0x30, 0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
0x0c, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x20, 0x17,
0x0d, 0x31, 0x37, 0x31, 0x32, 0x33, 0x30, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x18, 0x0f,
0x33, 0x30, 0x31, 0x37, 0x30, 0x35, 0x30, 0x32, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x30,
0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0c, 0x54, 0x65, 0x73, 0x74,
0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x81, 0xb5, 0x30, 0x81, 0x8e, 0x06, 0x07,
0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x30, 0x81, 0x82, 0x02, 0x01, 0x01, 0x30, 0x2c, 0x06,
0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x01, 0x01, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfc, 0x2f, 0x30, 0x06, 0x04, 0x01, 0x00,
0x04, 0x01, 0x07, 0x04, 0x21, 0x02, 0x79, 0xbe, 0x66, 0x7e, 0xf9, 0xdc, 0xbb, 0xac, 0x55, 0xa0,
0x62, 0x95, 0xce, 0x87, 0x0b, 0x07, 0x02, 0x9b, 0xfc, 0xdb, 0x2d, 0xce, 0x28, 0xd9, 0x59, 0xf2,
0x81, 0x5b, 0x16, 0xf8, 0x17, 0x98, 0x02, 0x21, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xba, 0xae, 0xdc, 0xe6, 0xaf, 0x48, 0xa0,
0x3b, 0xbf, 0xd2, 0x5e, 0x8c, 0xd0, 0x36, 0x41, 0x41, 0x02, 0x01, 0x01, 0x03, 0x22, 0x00, 0x03,
0x2a, 0xf9, 0x0b, 0xda, 0xbe, 0x71, 0x66, 0x9e, 0xd1, 0xcf, 0x12, 0xd0, 0x24, 0xaf, 0xba, 0xb6,
0x7f, 0xfb, 0x96, 0x27, 0x3e, 0x2f, 0xbd, 0x1e, 0xd5, 0xf9, 0x8d, 0x6c, 0x73, 0x9d, 0xc5, 0x16,
0xa3, 0x50, 0x30, 0x4e, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xca,
0x2a, 0xa1, 0x12, 0x97, 0x96, 0x2c, 0x85, 0xd3, 0x1f, 0xb1, 0x34, 0x7c, 0x26, 0xe9, 0xd6, 0x49,
0x9f, 0x98, 0xcf, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14,
0xca, 0x2a, 0xa1, 0x12, 0x97, 0x96, 0x2c, 0x85, 0xd3, 0x1f, 0xb1, 0x34, 0x7c, 0x26, 0xe9, 0xd6,
0x49, 0x9f, 0x98, 0xcf, 0x30, 0x0c, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01,
0x01, 0xff, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x04, 0x03, 0x47,
0x00, 0x30, 0x44, 0x02, 0x20, 0x24, 0x7a, 0xc1, 0xb4, 0x7d, 0x1c, 0x3c, 0x23, 0xc6, 0xad, 0xea,
0x04, 0x27, 0x27, 0x65, 0xb8, 0x72, 0x93, 0x46, 0xc9, 0xe9, 0x60, 0x8f, 0xca, 0x96, 0x30, 0x60,
0xb3, 0x22, 0xf7, 0x3b, 0x01, 0x02, 0x20, 0x48, 0x30, 0x2a, 0x58, 0x18, 0x46, 0xdb, 0x50, 0x3e,
0xad, 0xc3, 0xca, 0xcd, 0x6d, 0x83, 0xd4, 0xc3, 0xc4, 0xa4, 0x8f, 0x37, 0xc3, 0x1d, 0x83, 0x3c,
0xd3, 0x1f, 0x8f, 0x38, 0x29, 0x75, 0x2c
};
static const unsigned char x509_cert_short[] = { /* X.509 cert, long pubkey, curve by OID */
0x30, 0x82, 0x01, 0x74, 0x30, 0x82, 0x01, 0x1a, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00,
0xbd, 0x81, 0x04, 0x29, 0x43, 0x12, 0x79, 0xce, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce,
0x3d, 0x04, 0x03, 0x04, 0x30, 0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c,
0x0c, 0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x20, 0x17,
0x0d, 0x31, 0x37, 0x31, 0x32, 0x33, 0x30, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x18, 0x0f,
0x33, 0x30, 0x31, 0x37, 0x30, 0x35, 0x30, 0x32, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x30,
0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0c, 0x54, 0x65, 0x73, 0x74,
0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x56, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86,
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0x0a, 0x03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, 0x22, 0xfb, 0xd6, 0xec, 0x5d, 0xf9, 0x87, 0x82,
0xeb, 0x37, 0xb8, 0x32, 0x7c, 0xd6, 0x02, 0x20, 0x50, 0x8b, 0x9f, 0xc1, 0xa8, 0x4a, 0xff, 0x49,
0x0d, 0x7e, 0x04, 0x2d, 0x93, 0x3e, 0xdb, 0x30, 0xbc, 0x93, 0xd1, 0x16, 0x1d, 0x99, 0xbd, 0x3f,
0xfa, 0x2a, 0x6d, 0xe0, 0x2a, 0x83, 0x55, 0x5d
};
static const unsigned char x509_cert_shortc[] = { /* X.509 cert, compressed pubkey, curve by OID */
0x30, 0x82, 0x01, 0x54, 0x30, 0x81, 0xfa, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0x85,
0x45, 0x77, 0x75, 0x02, 0x95, 0xf7, 0x06, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
0x04, 0x03, 0x04, 0x30, 0x17, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0c,
0x54, 0x65, 0x73, 0x74, 0x20, 0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x20, 0x17, 0x0d,
0x31, 0x37, 0x31, 0x32, 0x33, 0x30, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x18, 0x0f, 0x33,
0x30, 0x31, 0x37, 0x30, 0x35, 0x30, 0x32, 0x32, 0x30, 0x33, 0x33, 0x34, 0x31, 0x5a, 0x30, 0x17,
0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0c, 0x0c, 0x54, 0x65, 0x73, 0x74, 0x20,
0x43, 0x65, 0x72, 0x74, 0x20, 0x45, 0x43, 0x30, 0x36, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86, 0x48,
0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b, 0x81, 0x04, 0x00, 0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, 0xa4, 0xfd, 0x3c, 0xc6, 0x49, 0x93, 0xd3, 0x5b, 0xef, 0xc9,
0xae, 0x97, 0xaf, 0x64, 0x64, 0xf9, 0x69, 0xd8
};
if (ltc_mp.sqrtmod_prime == NULL) return CRYPT_NOP; /* we need compressed points which requires sqrtmod_prime */
DO(ecc_import_openssl(short_pub, sizeof(short_pub), &pub));
DO(ecc_import_openssl(short_pri, sizeof(short_pri), &pri));
2018-07-04 08:38:38 +00:00
DO(ecc_find_curve("SECP256K1", &cu));
2017-12-30 21:30:36 +00:00
/* import - raw keys */
DO(ecc_set_curve(cu, &key));
2017-12-30 21:30:36 +00:00
DO(ecc_set_key(raw_pri, sizeof(raw_pri), PK_PRIVATE, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_set_curve(cu, &key));
2017-12-30 21:30:36 +00:00
DO(ecc_set_key(raw_pub, sizeof(raw_pub), PK_PUBLIC, &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_set_curve(cu, &key));
2017-12-30 21:30:36 +00:00
DO(ecc_set_key(raw_pubc, sizeof(raw_pubc), PK_PUBLIC, &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
/* import - openssl compatible DER format */
DO(ecc_import_openssl(long_pri, sizeof(long_pri), &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(long_pric, sizeof(long_pric), &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(long_pub, sizeof(long_pub), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(long_pubc, sizeof(long_pubc), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(short_pri, sizeof(short_pri), &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(short_pric, sizeof(short_pric), &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(short_pub, sizeof(short_pub), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_openssl(short_pubc, sizeof(short_pubc), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
2018-06-07 19:49:41 +00:00
/* import - private PKCS8 format - no password */
DO(ecc_import_pkcs8(long_pri_pkcs8, sizeof(long_pri_pkcs8), NULL, 0, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
DO(ecc_import_pkcs8(long_pric_pkcs8, sizeof(long_pric_pkcs8), NULL, 0, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
DO(ecc_import_pkcs8(short_pri_pkcs8, sizeof(short_pri_pkcs8), NULL, 0, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
DO(ecc_import_pkcs8(short_pric_pkcs8, sizeof(short_pric_pkcs8), NULL, 0, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
/* import - private PKCS8 format - password protected (PBES1 algorithms) */
#ifdef LTC_MD2
DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md2_des, sizeof(long_pri_pkcs8_pbe_md2_des), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#ifdef LTC_MD5
DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md5_des, sizeof(long_pri_pkcs8_pbe_md5_des), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#ifdef LTC_SHA1
DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_sha1_des, sizeof(long_pri_pkcs8_pbe_sha1_des), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_RC2) && defined(LTC_MD2)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md2_rc2_64, sizeof(long_pri_pkcs8_pbe_md2_rc2_64), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_RC2) && defined(LTC_MD5)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_md5_rc2_64, sizeof(long_pri_pkcs8_pbe_md5_rc2_64), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_RC2) && defined(LTC_SHA1)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbe_sha1_rc2_64, sizeof(long_pri_pkcs8_pbe_sha1_rc2_64), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
/* import - private PKCS8 format - password protected (PBES2 algorithms) */
#if defined(LTC_RC2)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_rc2_cbc, sizeof(long_pri_pkcs8_pbkdf2_rc2_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_DES)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_des_cbc, sizeof(long_pri_pkcs8_pbkdf2_des_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_DES)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_des_ede3_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_SHA224) && defined(LTC_DES)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha224_des_ede3_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_SHA256) && defined(LTC_DES)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha256_des_ede3_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_SHA384) && defined(LTC_DES)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha384_des_ede3_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
#if defined(LTC_SHA512) && defined(LTC_DES)
DO(ecc_import_pkcs8(long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc, sizeof(long_pri_pkcs8_pbkdf2_sha512_des_ede3_cbc), "secret", 6, &key));
DO(s_ecc_key_cmp(PK_PRIVATE, &pri, &key));
2018-06-07 19:49:41 +00:00
ecc_free(&key);
#endif
2017-12-30 21:30:36 +00:00
/* import - X.509 EC certificates */
DO(ecc_import_x509(x509_cert_long, sizeof(x509_cert_long), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_x509(x509_cert_longc, sizeof(x509_cert_longc), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_x509(x509_cert_short, sizeof(x509_cert_short), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
DO(ecc_import_x509(x509_cert_shortc, sizeof(x509_cert_shortc), &key));
DO(s_ecc_key_cmp(PK_PUBLIC, &pub, &key));
2017-12-30 21:30:36 +00:00
ecc_free(&key);
/* export - openssl compatible DER format */
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PRIVATE, &pri));
if (compare_testvector(out, outlen, long_pri, sizeof(long_pri), "e-long_pri", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PRIVATE|PK_COMPRESSED, &pri));
if (compare_testvector(out, outlen, long_pric, sizeof(long_pric), "e-long_pric", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PUBLIC, &pub));
if (compare_testvector(out, outlen, long_pub, sizeof(long_pub), "e-long_pub", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PUBLIC|PK_COMPRESSED, &pub));
if (compare_testvector(out, outlen, long_pubc, sizeof(long_pubc), "e-long_pubc", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PRIVATE|PK_CURVEOID, &pri));
if (compare_testvector(out, outlen, short_pri, sizeof(short_pri), "e-short_pri", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PRIVATE|PK_CURVEOID|PK_COMPRESSED, &pri));
if (compare_testvector(out, outlen, short_pric, sizeof(short_pric), "e-short_pric", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PUBLIC|PK_CURVEOID, &pub));
if (compare_testvector(out, outlen, short_pub, sizeof(short_pub), "e-short_pub", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_export_openssl(out, &outlen, PK_PUBLIC|PK_CURVEOID|PK_COMPRESSED, &pub));
if (compare_testvector(out, outlen, short_pubc, sizeof(short_pubc), "e-short_pubc", 0)) return CRYPT_ERROR;
/* export - raw keys */
outlen = sizeof(out);
DO(ecc_get_key(out, &outlen, PK_PRIVATE, &pri));
if (compare_testvector(out, outlen, raw_pri, sizeof(raw_pri), "e-raw_pri", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_get_key(out, &outlen, PK_PUBLIC, &pub));
if (compare_testvector(out, outlen, raw_pub, sizeof(raw_pub), "e-raw_pub", 0)) return CRYPT_ERROR;
outlen = sizeof(out);
DO(ecc_get_key(out, &outlen, PK_PUBLIC|PK_COMPRESSED, &pub));
if (compare_testvector(out, outlen, raw_pubc, sizeof(raw_pubc), "e-raw_pubc", 0)) return CRYPT_ERROR;
ecc_free(&pri);
ecc_free(&pub);
return CRYPT_OK;
}
#ifdef LTC_ECC_SHAMIR
static int s_ecc_test_recovery(void)
{
int i, recid, stat;
const ltc_ecc_curve* dp;
ecc_key key, privkey, pubkey, reckey;
unsigned char buf[1000];
unsigned long len;
unsigned char data16[16] = { 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1, 0xd1 };
unsigned char eth_hash[] = { /* Keccak-256 hash of "Hello World" */
0x59, 0x2f, 0xa7, 0x43, 0x88, 0x9f, 0xc7, 0xf9, 0x2a, 0xc2, 0xa3, 0x7b, 0xb1, 0xf5, 0xba, 0x1d,
0xaf, 0x2a, 0x5c, 0x84, 0x74, 0x1c, 0xa0, 0xe0, 0x06, 0x1d, 0x24, 0x3a, 0x2e, 0x67, 0x07, 0xba
};
unsigned char eth_pubkey[] = { /* Public part of randomly-generated key pair */
0x04,
0xc6, 0x99, 0x5f, 0xdc, 0xf4, 0xf2, 0xda, 0x6e, 0x79, 0xe0, 0x47, 0x12, 0xd3, 0xbe, 0x22, 0xe7,
0x65, 0xc6, 0xa3, 0x32, 0x89, 0x1b, 0x34, 0xba, 0xc1, 0xb7, 0x01, 0x83, 0xed, 0xdd, 0xf1, 0xcc,
0xbf, 0x20, 0xdd, 0xcd, 0x05, 0x4e, 0x49, 0xc8, 0xcb, 0x66, 0x6c, 0xb7, 0x71, 0x2f, 0x7e, 0xc1,
0xd6, 0x1a, 0x4a, 0x42, 0x3d, 0xe5, 0xc2, 0x8d, 0x74, 0x03, 0x81, 0xe7, 0xea, 0xc5, 0x3c, 0x10
};
unsigned char eth_sig[] = { /* Signature of eth_hash to be verified against eth_pubkey */
0xbd, 0x6d, 0xbb, 0xbe, 0x2d, 0xe7, 0x1d, 0x00, 0xae, 0x18, 0x57, 0x12, 0x1d, 0x63, 0xa5, 0x1b,
0x0b, 0x42, 0x71, 0xa2, 0x80, 0x49, 0xe0, 0x5c, 0xfa, 0xc8, 0x1a, 0x0d, 0x8a, 0x88, 0x67, 0x56,
0xf6, 0x67, 0x1b, 0x41, 0x46, 0x09, 0x4e, 0xd0, 0x44, 0x25, 0x18, 0xfd, 0xf4, 0xcd, 0x62, 0xa3,
0xb7, 0x3c, 0x97, 0x55, 0xfa, 0x69, 0xf8, 0xef, 0xe9, 0xcf, 0x12, 0xaf, 0x48, 0x25, 0xe3, 0xe0,
0x1b
};
/* XXX-FIXME: TFM does not support sqrtmod_prime */
if (strcmp(ltc_mp.name, "TomsFastMath") == 0) return CRYPT_NOP;
#ifdef LTC_ECC_SECP256K1
DO(ecc_find_curve("SECP256K1", &dp));
DO(ecc_set_curve(dp, &pubkey));
DO(ecc_set_key(eth_pubkey, sizeof(eth_pubkey), PK_PUBLIC, &pubkey));
DO(ecc_set_curve(dp, &reckey));
stat = ecc_recover_key(eth_sig, sizeof(eth_sig)-1, eth_hash, sizeof(eth_hash), 0, LTC_ECCSIG_RFC7518, &reckey);
if (stat != CRYPT_OK) return CRYPT_FAIL_TESTVECTOR;
DO(s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey));
ecc_free(&reckey);
DO(ecc_set_curve(dp, &reckey));
stat = ecc_recover_key(eth_sig, sizeof(eth_sig), eth_hash, sizeof(eth_hash), -1, LTC_ECCSIG_ETH27, &reckey);
if (stat != CRYPT_OK) return CRYPT_FAIL_TESTVECTOR;
DO(s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey));
ecc_free(&reckey);
ecc_free(&pubkey);
#endif
for (i = 0; i < (int)(sizeof(curvenames)/sizeof(curvenames[0])); i++) {
DO(ecc_find_curve(curvenames[i], &dp));
/* generate new key */
DO(ecc_set_curve(dp, &key));
DO(ecc_generate_key(&yarrow_prng, find_prng ("yarrow"), &key));
/* export private key */
len = sizeof(buf);
DO(ecc_get_key(buf, &len, PK_PRIVATE, &key));
ecc_free(&key);
/* load exported private key */
DO(ecc_set_curve(dp, &privkey));
DO(ecc_set_key(buf, len, PK_PRIVATE, &privkey));
/* export long public key */
len = sizeof(buf);
DO(ecc_get_key(buf, &len, PK_PUBLIC, &privkey));
if (len != 1 + 2 * (unsigned)ecc_get_size(&privkey)) return CRYPT_FAIL_TESTVECTOR;
/* load exported public key */
DO(ecc_set_curve(dp, &pubkey));
DO(ecc_set_key(buf, len, PK_PUBLIC, &pubkey));
/* test signature */
len = sizeof(buf);
recid = 0;
DO(ecc_sign_hash_ex(data16, 16, buf, &len, &yarrow_prng, find_prng ("yarrow"), LTC_ECCSIG_RFC7518, &recid, &privkey));
/* test verification */
stat = 0;
DO(ecc_verify_hash_ex(buf, len, data16, 16, LTC_ECCSIG_RFC7518, &stat, &pubkey));
if (stat != 1) return CRYPT_FAIL_TESTVECTOR;
/* test recovery */
DO(ecc_set_curve(dp, &reckey));
stat = ecc_recover_key(buf, len, data16, 16, recid, LTC_ECCSIG_RFC7518, &reckey);
if (stat != CRYPT_OK) return CRYPT_FAIL_TESTVECTOR;
DO(s_ecc_key_cmp(PK_PUBLIC, &pubkey, &reckey));
/* cleanup */
ecc_free(&reckey);
ecc_free(&privkey);
ecc_free(&pubkey);
}
return CRYPT_OK;
}
#endif
2018-11-07 08:25:08 +00:00
int ecc_test(void)
2004-10-30 03:00:26 +00:00
{
if (ltc_mp.name == NULL) return CRYPT_NOP;
DO(s_ecc_old_api()); /* up to 1.18 */
DO(s_ecc_new_api());
DO(s_ecc_import_export());
DO(s_ecc_test_mp());
DO(s_ecc_issue108());
DO(s_ecc_issue443_447());
2017-12-19 12:31:50 +00:00
#ifdef LTC_ECC_SHAMIR
DO(s_ecc_test_shamir());
DO(s_ecc_test_recovery());
2017-12-19 12:31:50 +00:00
#endif
return CRYPT_OK;
2004-10-30 03:00:26 +00:00
}
#endif