- err("OpenPGP RSA Key, with %d bits\n", pgp_bits);
+ err(0,"OpenPGP RSA Key, with %d bits\n", pgp_bits);
ret = gnutls_openpgp_privkey_export_rsa_raw(*pgp_privkey, &m, &e, &d, &p, &q, &u);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_privkey_export_rsa_raw(*pgp_privkey, &m, &e, &d, &p, &q, &u);
if (GNUTLS_E_SUCCESS != ret) {
return 1;
}
ret = gnutls_x509_privkey_import_rsa_raw (*output, &m, &e, &d, &p, &q, &u);
if (GNUTLS_E_SUCCESS != ret) {
return 1;
}
ret = gnutls_x509_privkey_import_rsa_raw (*output, &m, &e, &d, &p, &q, &u);
if (GNUTLS_E_SUCCESS != ret) {
- err("OpenPGP DSA Key, with %d bits\n", pgp_bits);
+ err(0,"OpenPGP DSA Key, with %d bits\n", pgp_bits);
ret = gnutls_openpgp_privkey_export_dsa_raw(*pgp_privkey, &p, &q, &g, &y, &x);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_privkey_export_dsa_raw(*pgp_privkey, &p, &q, &g, &y, &x);
if (GNUTLS_E_SUCCESS != ret) {
return 1;
}
ret = gnutls_x509_privkey_import_dsa_raw (*output, &p, &q, &g, &y, &x);
if (GNUTLS_E_SUCCESS != ret) {
return 1;
}
ret = gnutls_x509_privkey_import_dsa_raw (*output, &p, &q, &g, &y, &x);
if (GNUTLS_E_SUCCESS != ret) {
/* figure out if we've got the right thing: */
subkeycount = gnutls_openpgp_crt_get_subkey_count(*pgp_crt);
if (subkeycount < 0) {
/* figure out if we've got the right thing: */
subkeycount = gnutls_openpgp_crt_get_subkey_count(*pgp_crt);
if (subkeycount < 0) {
- err("No keyid passed in, but there were %d keys to choose from\n", subkeycount + 1);
+ err(0,"No keyid passed in, but there were %d keys to choose from\n", subkeycount + 1);
return 1;
}
}
if ((keyid == NULL) || (memcmp(*keyid, curkeyid, sizeof(gnutls_openpgp_keyid_t)) == 0)) {
/* we want to export the primary key: */
return 1;
}
}
if ((keyid == NULL) || (memcmp(*keyid, curkeyid, sizeof(gnutls_openpgp_keyid_t)) == 0)) {
/* we want to export the primary key: */
/* FIXME: this is almost identical to the block below for subkeys.
This clumsiness seems inherent in the gnutls OpenPGP API,
though. ugh. */
algo = gnutls_openpgp_crt_get_pk_algorithm(*pgp_crt, &bits);
if (algo < 0) {
/* FIXME: this is almost identical to the block below for subkeys.
This clumsiness seems inherent in the gnutls OpenPGP API,
though. ugh. */
algo = gnutls_openpgp_crt_get_pk_algorithm(*pgp_crt, &bits);
if (algo < 0) {
- err("OpenPGP RSA certificate, with %d bits\n", bits);
+ err(0,"OpenPGP RSA certificate, with %d bits\n", bits);
ret = gnutls_openpgp_crt_get_pk_rsa_raw(*pgp_crt, &m, &e);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_crt_get_pk_rsa_raw(*pgp_crt, &m, &e);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_crt_get_pk_dsa_raw(*pgp_crt, &p, &q, &g, &y);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_crt_get_pk_dsa_raw(*pgp_crt, &p, &q, &g, &y);
if (GNUTLS_E_SUCCESS != ret) {
for (subkeyidx = 0; (subkeyidx < subkeycount) && !found; subkeyidx++) {
ret = gnutls_openpgp_crt_get_subkey_id(*pgp_crt, subkeyidx, curkeyid);
if (ret) {
for (subkeyidx = 0; (subkeyidx < subkeycount) && !found; subkeyidx++) {
ret = gnutls_openpgp_crt_get_subkey_id(*pgp_crt, subkeyidx, curkeyid);
if (ret) {
- err("Could not get keyid of subkey with index %d (error: %d)\n", subkeyidx, ret);
+ err(0,"Could not get keyid of subkey with index %d (error: %d)\n", subkeyidx, ret);
/* FIXME: this is almost identical to the block above for the
primary key. */
algo = gnutls_openpgp_crt_get_subkey_pk_algorithm(*pgp_crt, subkeyidx, &bits);
if (algo < 0) {
/* FIXME: this is almost identical to the block above for the
primary key. */
algo = gnutls_openpgp_crt_get_subkey_pk_algorithm(*pgp_crt, subkeyidx, &bits);
if (algo < 0) {
- err("OpenPGP RSA certificate, with %d bits\n", bits);
+ err(0,"OpenPGP RSA certificate, with %d bits\n", bits);
ret = gnutls_openpgp_crt_get_subkey_pk_rsa_raw(*pgp_crt, subkeyidx, &m, &e);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_crt_get_subkey_pk_rsa_raw(*pgp_crt, subkeyidx, &m, &e);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_crt_get_subkey_pk_dsa_raw(*pgp_crt, subkeyidx, &p, &q, &g, &y);
if (GNUTLS_E_SUCCESS != ret) {
ret = gnutls_openpgp_crt_get_subkey_pk_dsa_raw(*pgp_crt, subkeyidx, &p, &q, &g, &y);
if (GNUTLS_E_SUCCESS != ret) {
return pipefd;
}
write(1, output_data, strlen(output_data));
if (0 != write_data_fd_with_length(pipefd, all, mpicount)) {
return pipefd;
}
write(1, output_data, strlen(output_data));
if (0 != write_data_fd_with_length(pipefd, all, mpicount)) {
/* slurp in the key from stdin */
if (ret = set_datum_fd(&data, 0), ret) {
/* slurp in the key from stdin */
if (ret = set_datum_fd(&data, 0), ret) {
return 1;
}
/* check whether it's a private key or a public key, by trying them: */
if ((gnutls_openpgp_privkey_import(pgp_privkey, &data, GNUTLS_OPENPGP_FMT_RAW, NULL, 0) == 0) ||
(gnutls_openpgp_privkey_import(pgp_privkey, &data, GNUTLS_OPENPGP_FMT_BASE64, NULL, 0) == 0)) {
/* we're dealing with a private key */
return 1;
}
/* check whether it's a private key or a public key, by trying them: */
if ((gnutls_openpgp_privkey_import(pgp_privkey, &data, GNUTLS_OPENPGP_FMT_RAW, NULL, 0) == 0) ||
(gnutls_openpgp_privkey_import(pgp_privkey, &data, GNUTLS_OPENPGP_FMT_BASE64, NULL, 0) == 0)) {
/* we're dealing with a private key */
return 1;
}
if ((gnutls_openpgp_crt_import(pgp_crt, &data, GNUTLS_OPENPGP_FMT_RAW) == 0) ||
(gnutls_openpgp_crt_import(pgp_crt, &data, GNUTLS_OPENPGP_FMT_BASE64) == 0)) {
/* we're dealing with a public key */
return 1;
}
if ((gnutls_openpgp_crt_import(pgp_crt, &data, GNUTLS_OPENPGP_FMT_RAW) == 0) ||
(gnutls_openpgp_crt_import(pgp_crt, &data, GNUTLS_OPENPGP_FMT_BASE64) == 0)) {
/* we're dealing with a public key */
ret = emit_public_openssh_from_pgp(&pgp_crt, use_keyid);
} else {
/* we have no idea what kind of key this is at all anyway! */
ret = emit_public_openssh_from_pgp(&pgp_crt, use_keyid);
} else {
/* we have no idea what kind of key this is at all anyway! */