13 if (-1 == cr_init()) return 1;
14 cr_key_t
*priv
= cr_key_init(), *pub
= cr_key_init();
15 if (0 == cr_load_priv_fl("./priv.pem", "masterkey", priv
) && 0 == cr_load_pub_fl("./pub.pem", pub
)) {
16 str_t
*src
= mkstr(CONST_STR_LEN("Good luck"), 8), *crp
= NULL
, *dcr
= NULL
;
17 time_t t0
= time(0), t1
= t0
+ 60;
18 const struct tm
*tm
= localtime(&t0
);
19 strftime(buf
, sizeof(buf
), "%a, %d %b %Y %H:%M:%S GMT ", tm
);
21 while (time(0) < t1
) {
22 if (0 == cr_encrypt_pub(pub
, src
->ptr
, src
->len
, &crp
)) {
23 if (0 == cr_decrypt_priv(priv
, crp
->ptr
, crp
->len
, &dcr
)) {
32 printf("%d\n", count
);
34 strftime(buf
, sizeof(buf
), "%a, %d %b %Y %H:%M:%S GMT ", tm
);