You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by dr...@apache.org on 2007/12/13 13:43:20 UTC
svn commit: r603910 - in /labs/badca/openssl: Makefile.in cert.c
Author: dreid
Date: Thu Dec 13 04:43:19 2007
New Revision: 603910
URL: http://svn.apache.org/viewvc?rev=603910&view=rev
Log:
Add some additional tests to the "C" test app in an effort to understand
the issues around getting keys from certificates. Something in the logic I'm
using isn't right :-(
Modified:
labs/badca/openssl/Makefile.in
labs/badca/openssl/cert.c
Modified: labs/badca/openssl/Makefile.in
URL: http://svn.apache.org/viewvc/labs/badca/openssl/Makefile.in?rev=603910&r1=603909&r2=603910&view=diff
==============================================================================
--- labs/badca/openssl/Makefile.in (original)
+++ labs/badca/openssl/Makefile.in Thu Dec 13 04:43:19 2007
@@ -6,9 +6,14 @@
LDFLAGS=@LDFLAGS@ @openssl_LDFLAGS@
LIBS=@LIBS@ @openssl_LIBS@
-all: $(LIB_OBJ) $(APP_OBJ)
- $(AR) -rs libcertmodule_c.a certmodule_c.o
- $(CC) -o cert cert.o libcertmodule_c.a $(LDFLAGS) $(LIBS)
+all: cert
+
+cert: $(LIB_OBJ) $(APP_OBJ)
+ @$(AR) -rs libcertmodule_c.a certmodule_c.o
+ @$(CC) -o cert cert.o libcertmodule_c.a $(LDFLAGS) $(LIBS)
+
+test: cert
+ ./cert
clean:
rm -f *.a *.o cert
Modified: labs/badca/openssl/cert.c
URL: http://svn.apache.org/viewvc/labs/badca/openssl/cert.c?rev=603910&r1=603909&r2=603910&view=diff
==============================================================================
--- labs/badca/openssl/cert.c (original)
+++ labs/badca/openssl/cert.c Thu Dec 13 04:43:19 2007
@@ -8,13 +8,17 @@
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+/* External function declarations for our library */
+RSA *readRSA(const char *);
+X509_REQ *readCSR(const char *);
X509 *readCert(const char *);
+X509 *signRequestWithCertificate(X509 *, X509_REQ *, RSA *);
int main(int argc, char **argv)
{
X509 *cert = NULL, *newcert = NULL;
X509_REQ *csr = NULL;
- RSA *key = NULL;
+ RSA *key = NULL, *key2 = NULL, *key3 = NULL;
printf("init'ing OpenSSL\n");
@@ -38,9 +42,22 @@
newcert = signRequestWithCertificate(cert, csr, key);
printf("newcert = %p\n", newcert);
+ printf("Trying to get copies of the certificates public key...\n");
+ printf("key object we created earlier is %p\n", key);
+ key2 = RSAPublicKey_dup(X509_get_pubkey(cert)->pkey.rsa);
+ printf("1st copy = %p\n", key2);
+ key3 = RSAPublicKey_dup(X509_get_pubkey(cert)->pkey.rsa);
+ printf("2nd copy = %p\n", key3);
+
+
+ RSA_free(key);
X509_free(newcert);
X509_REQ_free(csr);
X509_free(cert);
+
+ if (key2 != key)
+ RSA_free(key2);
+ RSA_free(key3);
return 0;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org