fixes
This commit is contained in:
parent
1f6e1cf37c
commit
16ae895312
1 changed files with 7 additions and 4 deletions
|
@ -141,7 +141,10 @@ class Signature {
|
||||||
$publicKeyPem = \Activitypub\get_publickey_by_actor( $actor, $keyId );
|
$publicKeyPem = \Activitypub\get_publickey_by_actor( $actor, $keyId );
|
||||||
|
|
||||||
if ( !is_wp_error( $publicKeyPem ) ) {
|
if ( !is_wp_error( $publicKeyPem ) ) {
|
||||||
|
// Probably overkill since we already have a seemingly weelformed PEM
|
||||||
$pkey = \openssl_pkey_get_details( \openssl_pkey_get_public( $publicKeyPem ) );
|
$pkey = \openssl_pkey_get_details( \openssl_pkey_get_public( $publicKeyPem ) );
|
||||||
|
|
||||||
|
// Verify Digest
|
||||||
$digest_gen = 'SHA-256=' . \base64_encode( \hash( 'sha256', $body, true ) );
|
$digest_gen = 'SHA-256=' . \base64_encode( \hash( 'sha256', $body, true ) );
|
||||||
if ( ! isset( $header_data['digest'][0] ) || ( $digest_gen !== $header_data['digest'][0] ) ) {
|
if ( ! isset( $header_data['digest'][0] ) || ( $digest_gen !== $header_data['digest'][0] ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -149,7 +152,7 @@ class Signature {
|
||||||
|
|
||||||
// Create a comparison string from the plaintext headers we got
|
// Create a comparison string from the plaintext headers we got
|
||||||
// in the same order as was given in the signature header,
|
// in the same order as was given in the signature header,
|
||||||
$data_plain = self::getPlainText(
|
$signing_headers = self::getPlainText(
|
||||||
explode(' ', trim( $headers ) ),
|
explode(' ', trim( $headers ) ),
|
||||||
$request
|
$request
|
||||||
);
|
);
|
||||||
|
@ -169,7 +172,7 @@ class Signature {
|
||||||
}
|
}
|
||||||
$activity = \json_decode( $body );
|
$activity = \json_decode( $body );
|
||||||
\error_log( 'activity->type: ' . print_r( $activity->type, true ) );
|
\error_log( 'activity->type: ' . print_r( $activity->type, true ) );
|
||||||
return false;
|
//return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// openssl method
|
// openssl method
|
||||||
|
@ -185,7 +188,7 @@ class Signature {
|
||||||
while ( $ossl_error = openssl_error_string() ) {
|
while ( $ossl_error = openssl_error_string() ) {
|
||||||
\error_log( 'openssl_error_string(): ' . $ossl_error );
|
\error_log( 'openssl_error_string(): ' . $ossl_error );
|
||||||
}
|
}
|
||||||
return false;
|
//return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue