IKEv1 XAuth: Fix XAuth task so that it reinitiates.
[strongswan.git] / scripts / keyid2sql.c
index 094e1af..e37303c 100644 (file)
@@ -15,9 +15,9 @@ int main(int argc, char *argv[])
        chunk_t chunk;
        char buf[8096];
        int read, n;
-       
+
        library_init(NULL);
-       lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, "gmp pubkey sha1");
+       lib->plugins->load(lib->plugins, NULL, PLUGINS);
        atexit(library_deinit);
 
        read = fread(buf, 1, sizeof(buf), stdin);
@@ -26,15 +26,15 @@ int main(int argc, char *argv[])
                fprintf(stderr, "reading key failed.\n");
                return -1;
        }
-       
+
        chunk = chunk_create(buf, read);
-       
+
        private = lib->creds->create(lib->creds, CRED_PRIVATE_KEY, KEY_RSA,
-                                                                BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+                                                                BUILD_BLOB_PEM, chunk_clone(chunk),
                                                                 BUILD_END);
        if (private)
        {
-               if (private->get_fingerprint(private, KEY_ID_PUBKEY_SHA1, &chunk))
+               if (private->get_fingerprint(private, KEYID_PUBKEY_SHA1, &chunk))
                {
                        printf("%d, X'", ID_KEY_ID);
                        for (n = 0; n < chunk.len; n++)
@@ -46,19 +46,19 @@ int main(int argc, char *argv[])
                private->destroy(private);
                return 0;
        }
-       
+
        public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
-                                                               BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+                                                               BUILD_BLOB_PEM, chunk_clone(chunk),
                                                                BUILD_END);
        if (!public)
        {
                public = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_RSA,
-                                                                       BUILD_BLOB_ASN1_DER, chunk_clone(chunk),
+                                                                       BUILD_BLOB_PEM, chunk_clone(chunk),
                                                                        BUILD_END);
        }
        if (public)
        {
-               if (public->get_fingerprint(public, KEY_ID_PUBKEY_SHA1, &chunk))
+               if (public->get_fingerprint(public, KEYID_PUBKEY_SHA1, &chunk))
                {
                        printf("%d, X'", ID_KEY_ID);
                        for (n = 0; n < chunk.len; n++)
@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
                public->destroy(public);
                return 0;
        }
-       
+
        fprintf(stderr, "unable to parse input key.\n");
        return -1;
 }