xmss-KAT-generator/test/xmss_keypair.c
Joost Rijneveld b8eb8c44a1
Add UI test files to create sample signatures
This makes it easier to mix and match with other implementations
for compatibility testing.
2017-10-17 17:11:18 +02:00

31 líneas
781 B
C

#include "../params.h"
#include "../xmss.h"
#include <stdio.h>
#include <stdint.h>
int main(int argc, char **argv)
{
xmss_params params;
uint32_t oid;
if (argc != 2) {
fprintf(stderr, "Expected parameter string (e.g. 'XMSS-SHA2_10_256')"
" as only parameter.\n"
"The keypair is written to stdout.\n");
return -1;
}
xmss_str_to_oid(&oid, argv[1]);
xmss_parse_oid(&params, oid);
unsigned char pk[XMSS_OID_LEN + params.publickey_bytes];
unsigned char sk[XMSS_OID_LEN + params.privatekey_bytes];
xmss_keypair(pk, sk, oid);
fwrite(pk, 1, XMSS_OID_LEN + params.publickey_bytes, stdout);
fwrite(sk, 1, XMSS_OID_LEN + params.privatekey_bytes, stdout);
fclose(stdout);
}