diff options
author | gregor herrmann <gregoa@debian.org> | 2022-04-02 18:06:17 +0200 |
---|---|---|
committer | gregor herrmann <gregoa@debian.org> | 2022-04-02 18:06:17 +0200 |
commit | f704ab7622ae6b0ada9aedbcef3dd5e4d00260ab (patch) | |
tree | 444b2e39dfb29493967ded3f51d67c9d54e669a0 | |
parent | 978fab9470d645631d75d4c892af69023ac567b1 (diff) |
New upstream version 0.19
-rwxr-xr-x | Changes | 5 | ||||
-rw-r--r-- | META.json | 2 | ||||
-rw-r--r-- | META.yml | 2 | ||||
-rwxr-xr-x | PKCS10.pm | 2 | ||||
-rwxr-xr-x | PKCS10.xs | 16 | ||||
-rwxr-xr-x | t/Mytest.t | 9 |
6 files changed, 26 insertions, 10 deletions
@@ -1,7 +1,10 @@ Revision history for Perl extension Crypt::OpenSSL::PKCS10. +0.19 Mon Mar 28 16:37:16 PDT 2022 + - Fix #120728 (thanks Michal Josef Špaček) + 0.18 Thu Mar 10 17:31:59 PST 2022 - - Improve Makefile.PL to detect LIBS and INC values automatically (thanks Michal Josef �pacek) + - Improve Makefile.PL to detect LIBS and INC values automatically (thanks Michal Josef Špaček) - Fix failing tests with OpenSSL 3 (Petr Pisar) 0.16 Mon Oct 17 09:36:48 PDT 2016 @@ -51,6 +51,6 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "0.18", + "version" : "0.19", "x_serialization_backend" : "JSON::PP version 2.27400_02" } @@ -27,5 +27,5 @@ resources: bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Crypt-OpenSSL-PKCS10 homepage: https://metacpan.org/pod/Crypt::OpenSSL::PKCS10 license: http://dev.perl.org/licenses/ -version: '0.18' +version: '0.19' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' @@ -30,7 +30,7 @@ our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); #); -our $VERSION = '0.18'; +our $VERSION = '0.19'; require XSLoader; XSLoader::load('Crypt::OpenSSL::PKCS10', $VERSION); @@ -12,10 +12,10 @@ #include "ppport.h" -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined LIBRESSL_VERSION_NUMBER #define EVP_PKEY_get0_RSA(pkey) ((pkey)->pkey.rsa) #define EVP_PKEY_get0_DSA(pkey) ((pkey)->pkey.dsa) -#ifndef OPENSSL_NO_EC +#ifndef OPENSSL_NO_EC || defined LIBRESSL_VERSION_NUMBER #define EVP_PKEY_get0_EC_KEY(pkey) ((pkey)->pkey.ec) #endif #endif @@ -549,17 +549,20 @@ get_pem_pk(pkcs10,...) CODE: if((ix != 1 && items > 1) || (ix == 1 && items != 2)) - croak("get_pem_req illegal/missing args"); + croak("get_pem_pk illegal/missing args"); if(items > 1) { bio = sv_bio_create_file(ST(1)); } else { bio = sv_bio_create(); } + if(!pkcs10->pk) + croak ("Private key doesn't exist"); + /* get the certificate back out in a specified format. */ if(!PEM_write_bio_PrivateKey(bio,pkcs10->pk,NULL,NULL,0,NULL,NULL)) - croak ("%s - PEM_write_bio_X509_REQ", pkcs10->req); + croak ("%s - PEM_write_bio_PrivateKey", pkcs10->pk); RETVAL = sv_bio_final(bio); @@ -628,7 +631,7 @@ add_custom_ext_raw(pkcs10, oid_SV, ext_SV) pkcs10->exts = sk_X509_EXTENSION_new_null(); if ((nid = OBJ_create(oid, oid, oid)) == NID_undef) - croak ("add_custom_ext_raw: OBJ_create() for OID %s failed", oid); + croak ("add_custom_ext: OBJ_create() for OID %s failed", oid); RETVAL = add_ext_raw(pkcs10->exts, nid, ext, ext_length); if (!RETVAL) @@ -701,6 +704,9 @@ new_from_file(class, filename_SV) CODE: filename = SvPV(filename_SV, filename_length); fp = fopen(filename, "r"); + if (fp == NULL) { + croak ("Cannot open file '%s'", filename); + } req = PEM_read_X509_REQ (fp, NULL, NULL, NULL); fclose(fp); @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; -use Test::More tests => 6; +use Test::More tests => 7; BEGIN { use_ok('Crypt::OpenSSL::PKCS10') }; ######################### @@ -61,3 +61,10 @@ print STDERR $req->pubkey_type()."\n"; print STDERR $req->get_pem_pubkey()."\n"; ok($req); } + +{ +eval { + Crypt::OpenSSL::PKCS10->new_from_file("file_doesnt_exist"); +}; +like($@, qr{^Cannot open file 'file_doesnt_exist'}, "Check error if file doesn't exist."); +} |