1313 */
1414interface RSAInterface
1515{
16-
1716 /**
1817 * @return BigIntegerInterface
1918 */
@@ -45,7 +44,7 @@ public function getModulus(): BigIntegerInterface;
4544 *
4645 * @return bool
4746 */
48- public function setPublicKey ($ key = false );
47+ public function setPublicKey ($ key = false ): bool ;
4948
5049 /**
5150 * Sets the password
@@ -57,7 +56,7 @@ public function setPublicKey($key = false);
5756 *
5857 * @return void
5958 */
60- public function setPassword ($ password = null );
59+ public function setPassword ($ password = null ): void ;
6160
6261 /**
6362 * Loads a public or private key
@@ -69,7 +68,7 @@ public function setPassword($password = null);
6968 *
7069 * @return bool
7170 */
72- public function loadKey ($ key , $ type = false );
71+ public function loadKey ($ key , $ type = false ): bool ;
7372
7473 /**
7574 * Decryption
@@ -78,7 +77,7 @@ public function loadKey($key, $type = false);
7877 *
7978 * @return string
8079 */
81- public function decrypt (string $ ciphertext );
80+ public function decrypt (string $ ciphertext ): string ;
8281
8382 /**
8483 * Encryption
@@ -91,7 +90,7 @@ public function decrypt(string $ciphertext);
9190 *
9291 * @return string
9392 */
94- public function encrypt (string $ plaintext );
93+ public function encrypt (string $ plaintext ): string ;
9594
9695 /**
9796 * Determines the public key format.
@@ -100,7 +99,7 @@ public function encrypt(string $plaintext);
10099 *
101100 * @return void
102101 */
103- public function setPublicKeyFormat (int $ format );
102+ public function setPublicKeyFormat (int $ format ): void ;
104103
105104 /**
106105 * Determines the private key format.
@@ -109,7 +108,7 @@ public function setPublicKeyFormat(int $format);
109108 *
110109 * @return void
111110 */
112- public function setPrivateKeyFormat (int $ format );
111+ public function setPrivateKeyFormat (int $ format ): void ;
113112
114113 /**
115114 * Determines which hashing function should be used.
@@ -121,7 +120,7 @@ public function setPrivateKeyFormat(int $format);
121120 *
122121 * @return void
123122 */
124- public function setHash (string $ hash );
123+ public function setHash (string $ hash ): void ;
125124
126125 /**
127126 * Determines which hashing function should be used for the mask generation function
@@ -133,7 +132,7 @@ public function setHash(string $hash);
133132 *
134133 * @return void
135134 */
136- public function setMGFHash ($ hash );
135+ public function setMGFHash ($ hash ): void ;
137136
138137 /**
139138 * Create public / private key pair.
@@ -158,7 +157,7 @@ public function createKey(int $bits = 1024, $timeout = false, array $partial = [
158157 *
159158 * @return string|null
160159 */
161- public function getPublicKey (int $ type = RSA ::PUBLIC_FORMAT_PKCS8 );
160+ public function getPublicKey (int $ type = RSA ::PUBLIC_FORMAT_PKCS8 ): ? string ;
162161
163162 /**
164163 * Returns the private key
@@ -167,9 +166,9 @@ public function getPublicKey(int $type = RSA::PUBLIC_FORMAT_PKCS8);
167166 *
168167 * @param int $type optional
169168 *
170- * @return mixed
169+ * @return string|null
171170 */
172- public function getPrivateKey (int $ type = RSA ::PUBLIC_FORMAT_PKCS1 );
171+ public function getPrivateKey (int $ type = RSA ::PUBLIC_FORMAT_PKCS1 ): ? string ;
173172
174173 /**
175174 * Create a signature
@@ -178,7 +177,7 @@ public function getPrivateKey(int $type = RSA::PUBLIC_FORMAT_PKCS1);
178177 *
179178 * @return string|null
180179 */
181- public function sign (string $ message );
180+ public function sign (string $ message ): ? string ;
182181
183182 /**
184183 * Set Signature Mode
@@ -189,7 +188,7 @@ public function sign(string $message);
189188 *
190189 * @return void
191190 */
192- public function setSignatureMode ($ mode );
191+ public function setSignatureMode ($ mode ): void ;
193192
194193 /**
195194 * EMSA-PKCS1-V1_5-ENCODE
@@ -201,7 +200,7 @@ public function setSignatureMode($mode);
201200 *
202201 * @return string
203202 */
204- public function emsaPkcs1V15Encode ($ m , $ emLen = null );
203+ public function emsaPkcs1V15Encode ($ m , $ emLen = null ): string ;
205204
206205 /**
207206 * EMSA-PSS-ENCODE
@@ -213,7 +212,7 @@ public function emsaPkcs1V15Encode($m, $emLen = null);
213212 *
214213 * @return string
215214 */
216- public function emsaPssEncode ($ m , $ emBits = null );
215+ public function emsaPssEncode ($ m , $ emBits = null ): string ;
217216
218217 /**
219218 * EMSA-PSS-VERIFY
@@ -226,16 +225,16 @@ public function emsaPssEncode($m, $emBits = null);
226225 * @param int|null $emBits
227226 * @return bool
228227 */
229- public function emsaPssVerify ($ m , $ em , $ emBits = null );
228+ public function emsaPssVerify ($ m , $ em , $ emBits = null ): bool ;
230229
231230 /**
232231 * Change password for private key.
233232 *
234- * @param string $privateKey
233+ * @param KeyPair $keyPair
235234 * @param string $oldPassword
236235 * @param string $newPassword
237236 *
238237 * @return KeyPair
239238 */
240- public function changePassword ($ privateKey , $ oldPassword , $ newPassword ): KeyPair ;
239+ public function changePassword ($ keyPair , $ oldPassword , $ newPassword ): KeyPair ;
241240}
0 commit comments