Skip to content

Commit 3bd21d2

Browse files
authored
Update RSA.php
1 parent c8552be commit 3bd21d2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Utils/RSA.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,32 @@ public static function generate($config = [])
2222
];
2323
}
2424

25+
public static function singleLinePublicKey($publicKey)
26+
{
27+
$string = str_replace([
28+
"-----BEGIN PUBLIC KEY-----\n",
29+
"-----END PUBLIC KEY-----",
30+
], '', $publicKey);
31+
32+
$stringArray = explode("\n", $string);
33+
$result = implode('', $stringArray);
34+
35+
return $result;
36+
}
37+
38+
public static function singleLinePrivateKey($privateKey)
39+
{
40+
$string = str_replace([
41+
"-----BEGIN PRIVATE KEY-----\n",
42+
"-----END PRIVATE KEY-----",
43+
], '', $privateKey);
44+
45+
$stringArray = explode("\n", $string);
46+
$result = implode('', $stringArray);
47+
48+
return $result;
49+
}
50+
2551
public static function normalPublicKey($publicKey)
2652
{
2753
$fKey = "-----BEGIN PUBLIC KEY-----\n";

0 commit comments

Comments
 (0)