x509 plugin supports encoding of CA basicConstraint extension
[strongswan.git] / scripts / key2keyid.c
index 15d1323..cc3e0b1 100644 (file)
@@ -15,9 +15,9 @@ int main(int argc, char *argv[])
        chunk_t chunk;
        char buf[8096];
        int read;
-       
+
        library_init(NULL);
-       lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, "gmp pubkey sha1");
+       lib->plugins->load(lib->plugins, IPSEC_PLUGINDIR, PLUGINS);
        atexit(library_deinit);
 
        read = fread(buf, 1, sizeof(buf), stdin);
@@ -26,11 +26,11 @@ 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)
        {
@@ -52,14 +52,14 @@ 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)
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
                public->destroy(public);
                return 0;
        }
-       
+
        fprintf(stderr, "unable to parse input key.\n");
        return -1;
 }