Skip to content

Commit 114d78a

Browse files
committed
Bump version to 0.38 for release to CPAN
1 parent 199506d commit 114d78a

4 files changed

Lines changed: 145 additions & 14 deletions

File tree

Changes

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,108 @@
11
Revision history for Perl extension Crypt::OpenSSL::RSA.
22

3+
0.38 Apr 23 2026
4+
5+
[Bug Fixes]
6+
- PR #103 GH #61: Re-enable PKCS#1 v1.5 padding for sign()/verify(). It
7+
was incorrectly disabled in 0.35; the Marvin attack only affects
8+
decryption, not signatures.
9+
- PR #168: Fix croak message to reference use_pkcs1_oaep_padding() (not
10+
use_pkcs1_padding()) when non-OAEP padding is used for encrypt/decrypt.
11+
- PR #165: Fix OAEP overhead calculation that was hardcoded for SHA-1;
12+
correct overhead is now computed per the configured hash algorithm.
13+
- PR #141: Reject non-RSA keys (EC, DSA, RSA-PSS) loaded via
14+
_load_rsa_key() on OpenSSL 3.x with a clear error instead of a
15+
confusing failure later.
16+
- PR #118: Fix private_encrypt() and public_decrypt() broken on OpenSSL
17+
3.x with any padding except NO_PADDING; rsa_crypt() now distinguishes
18+
encrypt vs. sign paths.
19+
- PR #142: Free signature buffer on RSA_sign() failure on pre-3.x.
20+
- PR #164 GH #152: Drain OpenSSL error queue after _get_key_parameters()
21+
on OpenSSL 3.x so a failed optional-param lookup does not pollute the
22+
error queue for subsequent operations.
23+
- PR #161 GH #152: Cache is_private_key flag in rsaData struct to avoid a
24+
per-call BIGNUM heap allocation on OpenSSL 3.x.
25+
- PR #159 GH #155: Check return values of EVP_PKEY_get_bn_param() in
26+
_get_key_parameters(); a failed mandatory param (n or e) now croaks
27+
instead of silently returning undef.
28+
- PR #160 GH #156: Use THROW macro for make_rsa_obj() result in
29+
_new_key_from_parameters() to prevent resource leak on a NULL return.
30+
- PR #158 GH #154: Extract setup_pss_sign_ctx() helper to deduplicate
31+
PSS context setup in sign() and verify(); the two paths could previously
32+
diverge silently.
33+
- PR #157 GH #153: Eliminate duplicate NID-to-name table in
34+
get_message_digest(); fixes whirlpool on OpenSSL 3.x where the old
35+
low-level WHIRLPOOL() API path was being used instead of EVP_MD_fetch().
36+
- PR #145: Fix BIO resource leak in extractBioString() error paths.
37+
- PR #143: Validate that a private key is present before attempting export
38+
in get_private_key_string().
39+
- PR #140: NULL out BIGNUMs after freeing them in _new_key_from_parameters()
40+
to prevent a double-free when make_rsa_obj() fails after they are freed.
41+
- PR #137: Use BN_clear_free() (instead of BN_free()) for private key
42+
BIGNUMs in _get_key_parameters() to scrub sensitive material.
43+
- PR #136: Remove static buffer in get_message_digest() that caused
44+
thread-safety problems under Perl ithreads.
45+
- PR #134: Add Perl-level stub for use_sslv23_padding() on OpenSSL 3.x
46+
where the underlying RSA_SSLV23_PADDING constant was removed.
47+
- PR #133: Fix PSS MGF1 setup to inspect the correct padding fields
48+
(sign_pad/verify_pad) instead of p_rsa->padding, preventing wrong
49+
MGF1 hash on auto-promoted PSS operations.
50+
- PR #120: Check PEM_write_bio_* return values in key export functions
51+
so failures are reported rather than silently ignored.
52+
- PR #119: Migrate SHA* digest calls to EVP_Q_digest() on OpenSSL 3.x,
53+
replacing deprecated low-level SHA*() functions.
54+
- PR #109: Drain the full OpenSSL error queue in croakSsl() and report
55+
the last (most specific) error rather than the oldest one.
56+
- PR #104: Guard croakSsl() against a NULL error string from
57+
ERR_reason_error_string() to prevent a NULL-deref croak.
58+
- PR #76: Do not include whrlpool.h when whirlpool support is disabled.
59+
- Memory leak fixes across OpenSSL 3.x code paths (PR #75, PR #77, PR #78,
60+
PR #79, PR #80, PR #81, PR #83, PR #87, PR #90, PR #99, PR #101, PR #108,
61+
PR #112, PR #114, PR #127, PR #128, PR #129, PR #131): plugged leaks in
62+
generate_key(), sign(), verify(), rsa_crypt(), check_key(),
63+
get_public_key_string(), _new_key_from_parameters(), and
64+
_get_key_parameters() across success and error paths.
65+
66+
[Improvements]
67+
- PR #169: Make Crypt::OpenSSL::Bignum a hard runtime requirement (moved
68+
from recommended to required in Makefile.PL and added hard import in
69+
RSA.pm); it was already required in practice for get_key_parameters().
70+
- PR #126: new_public_key() now accepts DER-encoded public keys in addition
71+
to PEM; format is detected automatically via ASN.1 OID inspection.
72+
- PR #124: Add get_private_key_pkcs8_string() to export private keys in
73+
PKCS#8 PEM format.
74+
- PR #110: Add get_public_key_pkcs1_string() as an alias for
75+
get_public_key_string() for API symmetry with the X.509/PKCS#1 naming.
76+
- PR #111: Add optional check=>1 parameter to new_key_from_parameters()
77+
to validate the constructed key via check_key() before returning it.
78+
- PR #135: Add plaintext length pre-validation in rsa_crypt() with a
79+
descriptive croak before attempting the OpenSSL operation.
80+
- PR #151: Reject invalid (even-numbered) RSA exponents before passing
81+
them to OpenSSL, preventing a potential hang during key generation.
82+
83+
[Maintenance]
84+
- PR #163: Add CONTRIBUTING.md and SECURITY.md to satisfy CPANTS
85+
experimental kwalitee metrics.
86+
- PR #144: Clean up Makefile.PL metadata: remove dead -DPERL5 and
87+
-DOPENSSL_NO_KRB5 defines; derive version dynamically from RSA.pm.
88+
- PR #130: Add test coverage for generate_key() with custom public
89+
exponents and exponent validation.
90+
- PR #121: Add test coverage for private_encrypt() and public_decrypt().
91+
- PR #148: Add PKCS#1 v1.5 signing regression tests (PR #148).
92+
- PR #95: Add error-path and edge-case test coverage (t/error.t).
93+
- PR #115, PR #116: Add encrypt/decrypt and sign/verify edge-case tests.
94+
- PR #85, PR #86, PR #88, PR #91: Improve test assertions — replace bare
95+
ok() calls with is()/like() and add descriptive test names throughout.
96+
- PR #84: Add macOS CI job covering both system LibreSSL and Homebrew
97+
OpenSSL 3.x.
98+
- PR #123: Add Valgrind memory-leak detection CI job on Debian bookworm.
99+
- PR #73: Fix META URLs, remove duplicate .gitignore entries, fix
100+
build_requires; add Debian trixie (OpenSSL 3.4.x) to CI matrix.
101+
- PR #72: Bump actions/checkout from v4 to v6.
102+
- PR #82: Bump perl-actions/perl-versions from 1 to 2.
103+
- PR #70: Add Dependabot for automatic GitHub Actions version updates.
104+
- PR #69: Remove Debian buster from CI matrix (EOL).
105+
3106
0.37 Oct 29 2025
4107
- Fix libressl bitwise logic error in RSA.xs
5108

MANIFEST

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ LICENSE
66
Makefile.PL
77
MANIFEST
88
MANIFEST.SKIP
9-
README
109
README.md
1110
RSA.pm
1211
RSA.xs
1312
SECURITY.md
1413
t/bignum.t
1514
t/check_param.t
1615
t/crypto.t
16+
t/der.t
1717
t/error.t
1818
t/error_queue.t
1919
t/fakelib/Crypt/OpenSSL/Bignum.pm
2020
t/format.t
2121
t/get_key_parameters.t
2222
t/key_lifecycle.t
2323
t/keygen.t
24+
t/openssl_der.t
2425
t/padding.t
2526
t/pkcs1_sign.t
2627
t/private_crypt.t
2728
t/private_encrypt.t
2829
t/pss_auto_promote.t
2930
t/rsa.t
30-
t/sig_die.t
3131
t/sign_verify.t
3232
t/z_kwalitee.t
3333
t/z_meta.t

README.md

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,15 @@ this (never documented) behavior is no longer the case.
5656
- new\_public\_key
5757

5858
Create a new `Crypt::OpenSSL::RSA` object by loading a public key in
59-
from a string containing Base64/DER-encoding of either the PKCS1 or
60-
X.509 representation of the key. The string should include the
61-
`-----BEGIN...-----` and `-----END...-----` lines.
59+
from a string containing either PEM or DER encoding of the PKCS#1 or
60+
X.509 representation of the key.
61+
62+
For PEM keys, the string should include the `-----BEGIN...-----` and
63+
`-----END...-----` lines. Both `BEGIN RSA PUBLIC KEY` (PKCS#1) and
64+
`BEGIN PUBLIC KEY` (X.509/SubjectPublicKeyInfo) formats are supported.
65+
66+
DER-encoded keys (raw binary ASN.1) are also accepted and the format
67+
(PKCS#1 vs X.509) is auto-detected.
6268

6369
The padding is set to PKCS1\_OAEP, but can be changed with the
6470
`use_xxx_padding` methods.
@@ -69,16 +75,21 @@ this (never documented) behavior is no longer the case.
6975
- new\_private\_key
7076

7177
Create a new `Crypt::OpenSSL::RSA` object by loading a private key in
72-
from an string containing the Base64/DER encoding of the PKCS1
73-
representation of the key. The string should include the
74-
`-----BEGIN...-----` and `-----END...-----` lines. The padding is set to
75-
PKCS1\_OAEP, but can be changed with `use_xxx_padding`.
78+
from a string containing either PEM or DER encoding of the key.
7679

77-
An optional parameter can be passed for passphase protected private key:
80+
For PEM keys, the string should include the `-----BEGIN...-----` and
81+
`-----END...-----` lines. The padding is set to PKCS1\_OAEP, but can
82+
be changed with `use_xxx_padding`.
7883

79-
- passphase
84+
DER-encoded keys (raw binary ASN.1) are also accepted.
8085

81-
The passphase which protects the private key.
86+
An optional parameter can be passed for passphrase-protected PEM private
87+
keys:
88+
89+
- passphrase
90+
91+
The passphrase which protects the private key. Note: passphrase
92+
protection is only supported for PEM-encoded keys.
8293

8394
- generate\_key
8495

@@ -172,6 +183,20 @@ this (never documented) behavior is no longer the case.
172183
The cipher algorithm used to protect the private key. Default to
173184
'des3'.
174185

186+
- get\_private\_key\_pkcs8\_string
187+
188+
Return the Base64/DER-encoded PKCS#8 representation of the private
189+
key. This string has header and footer lines:
190+
191+
-----BEGIN PRIVATE KEY-----
192+
-----END PRIVATE KEY-----
193+
194+
This is the format produced by `openssl pkey -outform PEM`, and is
195+
the private-key counterpart of `get_public_key_x509_string`.
196+
197+
Accepts the same optional passphrase and cipher-name parameters as
198+
`get_private_key_string`.
199+
175200
- encrypt
176201

177202
Encrypt a binary "string" using the public (portion of the) key.
@@ -183,11 +208,14 @@ this (never documented) behavior is no longer the case.
183208
- private\_encrypt
184209

185210
Encrypt a binary "string" using the private key. Croaks if the key is
186-
public only.
211+
public only. On OpenSSL 3.x, only `use_no_padding` and
212+
`use_pkcs1_padding` are supported; OAEP and PSS will croak.
187213

188214
- public\_decrypt
189215

190216
Decrypt a binary "string" using the public (portion of the) key.
217+
On OpenSSL 3.x, only `use_no_padding` and `use_pkcs1_padding`
218+
are supported; OAEP and PSS will croak.
191219

192220
- sign
193221

RSA.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use warnings;
66
use Carp; # Removing carp will break the XS code.
77
use Crypt::OpenSSL::Bignum;
88

9-
our $VERSION = '0.37';
9+
our $VERSION = '0.38';
1010

1111
use XSLoader;
1212
XSLoader::load 'Crypt::OpenSSL::RSA', $VERSION;

0 commit comments

Comments
 (0)