Skip to content

Commit 9d1decf

Browse files
authored
Be more defensive when openssl (#895)
1 parent 63fc9eb commit 9d1decf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

includes/class-signature.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,12 @@ protected static function generate_key_pair_for( $user_id ) {
9494

9595
$key = \openssl_pkey_new( $config );
9696
$priv_key = null;
97+
$detail = array();
98+
if ( $key ) {
99+
\openssl_pkey_export( $key, $priv_key );
97100

98-
\openssl_pkey_export( $key, $priv_key );
99-
100-
$detail = \openssl_pkey_get_details( $key );
101+
$detail = \openssl_pkey_get_details( $key );
102+
}
101103

102104
// check if keys are valid
103105
if (

0 commit comments

Comments
 (0)