diff options
author | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-04-21 03:10:19 -0400 |
---|---|---|
committer | Daniel Kahn Gillmor <dkg@fifthhorseman.net> | 2008-04-21 03:10:19 -0400 |
commit | d1ac46b53ec182fec1397ccd651a699551a99970 (patch) | |
tree | d3dcc20f05d22140d49429720474e90af5369fd9 /gnutls-helpers.c | |
parent | a4c93ce43a942be7f92248cb1ef3a1d3313bce5e (diff) |
initial pass at converting PEM-encoded private keys into OpenPGP public keys.
Diffstat (limited to 'gnutls-helpers.c')
-rw-r--r-- | gnutls-helpers.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gnutls-helpers.c b/gnutls-helpers.c index 5a567e2..6eae29e 100644 --- a/gnutls-helpers.c +++ b/gnutls-helpers.c @@ -345,3 +345,20 @@ int validate_ssh_host_userid(const char* userid) { setlocale(LC_ALL, oldlocale); return 1; } + +/* http://tools.ietf.org/html/rfc4880#section-5.5.2 */ +size_t get_openpgp_mpi_size(gnutls_datum_t* d) { + return 2 + d->size; +} + +int write_openpgp_mpi_to_fd(int fd, gnutls_datum_t* d) { + uint16_t x; + + x = d->size * 8; + x = htons(x); + + write(fd, &x, sizeof(x)); + write(fd, d->data, d->size); + + return 0; +} |