diff options
author | Martin Willi <martin@strongswan.org> | 2009-08-25 11:29:51 +0200 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2009-08-26 11:23:55 +0200 |
commit | 94dde8a0ab2ff82cfd8e61e3fac5a9a69cabdace (patch) | |
tree | 115d54df5790dee78d3461ceda8a22e08cc0c202 /scripts | |
parent | 9c3d2b3d60a1616813ccc88bbc036c983d0733b4 (diff) | |
download | strongswan-94dde8a0ab2ff82cfd8e61e3fac5a9a69cabdace.tar.bz2 strongswan-94dde8a0ab2ff82cfd8e61e3fac5a9a69cabdace.tar.xz |
migrated scripts to new fingerprinting API
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/key2keyid.c | 32 | ||||
-rw-r--r-- | scripts/keyid2sql.c | 31 |
2 files changed, 38 insertions, 25 deletions
diff --git a/scripts/key2keyid.c b/scripts/key2keyid.c index 201670e43..15d13238c 100644 --- a/scripts/key2keyid.c +++ b/scripts/key2keyid.c @@ -37,10 +37,18 @@ int main(int argc, char *argv[]) printf("parsed %d bits %N private key.\n", private->get_keysize(private)*8, key_type_names, private->get_type(private)); - printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_INFO_SHA1, - private->get_id(private, ID_PUBKEY_INFO_SHA1)); - printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_SHA1, - private->get_id(private, ID_PUBKEY_SHA1)); + if (private->get_fingerprint(private, KEY_ID_PUBKEY_INFO_SHA1, &chunk)) + { + printf("subjectPublicKeyInfo keyid: %#B\n", &chunk); + } + if (private->get_fingerprint(private, KEY_ID_PUBKEY_SHA1, &chunk)) + { + printf("subjectPublicKey keyid: %#B\n", &chunk); + } + if (private->get_fingerprint(private, KEY_ID_PGPV3, &chunk)) + { + printf("PGP verison 3 keyid: %#B\n", &chunk); + } private->destroy(private); return 0; } @@ -59,10 +67,18 @@ int main(int argc, char *argv[]) printf("parsed %d bits %N public key.\n", public->get_keysize(public)*8, key_type_names, public->get_type(public)); - printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_INFO_SHA1, - public->get_id(public, ID_PUBKEY_INFO_SHA1)); - printf("%N is:\t %D\n", id_type_names, ID_PUBKEY_SHA1, - public->get_id(public, ID_PUBKEY_SHA1)); + if (public->get_fingerprint(public, KEY_ID_PUBKEY_INFO_SHA1, &chunk)) + { + printf("subjectPublicKeyInfo keyid: %#B\n", &chunk); + } + if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &chunk)) + { + printf("subjectPublicKey keyid: %#B\n", &chunk); + } + if (public->get_fingerprint(public, KEY_ID_PGPV3, &chunk)) + { + printf("PGP verison 3 keyid: %#B\n", &chunk); + } public->destroy(public); return 0; } diff --git a/scripts/keyid2sql.c b/scripts/keyid2sql.c index 588bd7ac0..094e1afed 100644 --- a/scripts/keyid2sql.c +++ b/scripts/keyid2sql.c @@ -2,11 +2,9 @@ #include <stdio.h> #include <library.h> #include <debug.h> -#include <utils/identification.h> #include <credentials/keys/private_key.h> #include <credentials/keys/public_key.h> - /** * print the keyids of a private or public key in sql format */ @@ -14,7 +12,6 @@ int main(int argc, char *argv[]) { public_key_t *public; private_key_t *private; - identification_t *keyid; chunk_t chunk; char buf[8096]; int read, n; @@ -37,15 +34,15 @@ int main(int argc, char *argv[]) BUILD_END); if (private) { - keyid = private->get_id(private, ID_PUBKEY_INFO_SHA1); - chunk = keyid->get_encoding(keyid); - - printf("%d, X'", ID_PUBKEY_INFO_SHA1); - for (n = 0; n < chunk.len; n++) + if (private->get_fingerprint(private, KEY_ID_PUBKEY_SHA1, &chunk)) { - printf("%.2x", chunk.ptr[n]); + printf("%d, X'", ID_KEY_ID); + for (n = 0; n < chunk.len; n++) + { + printf("%.2x", chunk.ptr[n]); + } + printf("'\n"); } - printf("'\n"); private->destroy(private); return 0; } @@ -61,15 +58,15 @@ int main(int argc, char *argv[]) } if (public) { - keyid = public->get_id(public, ID_PUBKEY_INFO_SHA1); - chunk = keyid->get_encoding(keyid); - - printf("%d, X'", ID_PUBKEY_INFO_SHA1); - for (n = 0; n < chunk.len; n++) + if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &chunk)) { - printf("%.2x", chunk.ptr[n]); + printf("%d, X'", ID_KEY_ID); + for (n = 0; n < chunk.len; n++) + { + printf("%.2x", chunk.ptr[n]); + } + printf("'\n"); } - printf("'\n"); public->destroy(public); return 0; } |