diff -up Crypt-OpenSSL-X509-0.7/t/x509.t.openssl Crypt-OpenSSL-X509-0.7/t/x509.t
--- Crypt-OpenSSL-X509-0.7/t/x509.t.openssl 2009-08-26 10:06:16.000000000 +0200
+++ Crypt-OpenSSL-X509-0.7/t/x509.t 2009-08-26 10:05:21.000000000 +0200
@@ -12,7 +12,7 @@ ok($x509->fingerprint_md5() eq '51:86:E8
ok($x509->issuer() eq 'C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority', 'issuer()');
ok($x509->subject() eq 'C=US, O=VeriSign, Inc., OU=Class 1 Public Primary Certification Authority', 'subject()');
-ok($x509->hash() eq '2edf7016', 'hash()');
+ok($x509->hash() eq '2edf7016' or '24ad0b63', 'hash()');
ok($x509 = Crypt::OpenSSL::X509->new_from_file('certs/thawte.pem'), 'new_from_file()');
diff -up Crypt-OpenSSL-X509-0.7/X509.xs.openssl Crypt-OpenSSL-X509-0.7/X509.xs
--- Crypt-OpenSSL-X509-0.7/X509.xs.openssl 2008-02-23 23:18:11.000000000 +0100
+++ Crypt-OpenSSL-X509-0.7/X509.xs 2009-08-25 23:12:45.000000000 +0200
@@ -252,12 +252,19 @@ accessor(x509)
} else if (ix == 7) {
int j;
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ STACK_OF(OPENSSL_STRING) *emlst = X509_get1_email(x509);
+
+ for (j = 0; j < sk_OPENSSL_STRING_num(emlst); j++) {
+ BIO_printf(bio, "%s", sk_OPENSSL_STRING_value(emlst, j));
+ }
+#else
STACK *emlst = X509_get1_email(x509);
for (j = 0; j < sk_num(emlst); j++) {
BIO_printf(bio, "%s", sk_value(emlst, j));
}
-
+#endif
X509_email_free(emlst);
}
@@ -289,7 +296,17 @@ as_string(x509, format = FORMAT_PEM)
i2d_X509_bio(bio, x509);
} else if (format == FORMAT_NETSCAPE) {
+#if OPENSSL_VERSION_NUMBER >= 0x10000000L
+ NETSCAPE_X509 nx;
+ ASN1_OCTET_STRING hdr;
+
+ hdr.data = (unsigned char *)NETSCAPE_CERT_HDR;
+ hdr.length = strlen(NETSCAPE_CERT_HDR);
+ nx.header = &hdr;
+ nx.cert = x509;
+ ASN1_item_i2d_bio(ASN1_ITEM_rptr(NETSCAPE_X509), bio, &nx);
+#else
ASN1_HEADER ah;
ASN1_OCTET_STRING os;
@@ -300,6 +317,7 @@ as_string(x509, format = FORMAT_PEM)
ah.meth = X509_asn1_meth();
ASN1_i2d_bio(i2d_ASN1_HEADER, bio, (unsigned char *)&ah);
+#endif
}
RETVAL = sv_bio_final(bio);