Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Apply fixes from StyleCI #229

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/Component/Encryption/Util/RSACrypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ final class RSACrypt
public const ENCRYPTION_PKCS1 = 2;

/**
* @param RSAKey $key
* @param string $data
* @param int $mode
* @param RSAKey $key
* @param string $data
* @param int $mode
* @param null|string $hash
*
* @return string
Expand All @@ -50,9 +50,9 @@ public static function encrypt(RSAKey $key, string $data, int $mode, ?string $ha
}

/**
* @param RSAKey $key
* @param string $plaintext
* @param int $mode
* @param RSAKey $key
* @param string $plaintext
* @param int $mode
* @param null|string $hash
*
* @return string
Expand Down
13 changes: 8 additions & 5 deletions src/Component/Signature/Util/RSA.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ private static function verifyEMSAPSS(string $m, string $em, int $emBits, Hash $

/**
* @param string $m
* @param int $emBits
* @param Hash $hash
* @param int $emBits
* @param Hash $hash
*
* @return string
*/
Expand All @@ -185,17 +185,20 @@ private static function encodeEMSA15(string $m, int $emBits, Hash $hash): string
switch ($hash->name()) {
case 'sha256':
$t = "\x30\x31\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01\x05\x00\x04\x20";

break;
case 'sha384':
$t = "\x30\x41\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02\x05\x00\x04\x30";

break;
case 'sha512':
$t = "\x30\x51\x30\x0d\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03\x05\x00\x04\x40";

break;
default:
throw new \InvalidArgumentException();
}
$t.= $h;
$t .= $h;
$tLen = mb_strlen($t, '8bit');
if ($emBits < $tLen + 11) {
throw new \RuntimeException();
Expand All @@ -210,7 +213,7 @@ private static function encodeEMSA15(string $m, int $emBits, Hash $hash): string
* @param RSAKey $key
* @param string $message
* @param string $hash
* @param int $mode
* @param int $mode
*
* @return string
*/
Expand Down Expand Up @@ -273,7 +276,7 @@ public static function signWithPKCS15(RSAKey $key, string $message, string $hash
* @param string $message
* @param string $signature
* @param string $hash
* @param int $mode
* @param int $mode
*
* @return bool
*/
Expand Down