Skip to content

Commit

Permalink
Merge pull request #74 from jedisct1/serial
Browse files Browse the repository at this point in the history
Use the certificate timestamp as a serial number
  • Loading branch information
cofyc authored Jun 13, 2016
2 parents 13316e1 + 80b6967 commit 58e1dd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cert.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ cert_build_cert(const uint8_t *crypt_publickey, int cert_file_expire_days)
crypto_box_PUBLICKEYBYTES);
memcpy(signed_cert->magic_query, crypt_publickey,
sizeof(signed_cert->magic_query));
memcpy(signed_cert->serial, "0001", 4);
uint32_t ts_begin = (uint32_t)time(NULL);
uint32_t ts_end = ts_begin + cert_file_expire_days * 24 * 3600;
if (cert_file_expire_days <= 0) {
ts_begin = ts_end;
}
ts_begin = htonl(ts_begin);
ts_end = htonl(ts_end);
memcpy(signed_cert->serial, &ts_begin, 4);
memcpy(signed_cert->ts_begin, &ts_begin, 4);
memcpy(signed_cert->ts_end, &ts_end, 4);
memset(signed_cert->end, 0, sizeof(signed_cert->end));
Expand Down

0 comments on commit 58e1dd7

Please sign in to comment.