#include <sys/types.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>

#include <pem.h>

#include "libopgp.h"

int main(int argc, char *argv[])
{
  RSA *rsakey = RSA_new();
  keyid_t keyid = 0;

  sscanf(argv[1], "%llX", &keyid);

  PGP_gtkey((void **) &rsakey, "", &keyid);

  PEM_write_RSAPrivateKey(stdout, rsakey, 0, NULL, 0, NULL);
  return 0;
}
