Created
June 29, 2019 18:59
-
-
Save ferdiunal/0630dcd416b280213b735ecc0a86dfce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN RSA PRIVATE KEY----- | |
MIIJJgIBAAKCAgBoe2f+iDWW+xMsnKeL31ZRxPw0Gvj8Eku8MTWkFwISRF7vwepx | |
JWHGs2Ud/v7BZwh+aPlhp32n5JI431/XW/BFcGk3bS3tYkUBEP+cpwWJe9UDaQwN | |
wF3eg4WWb6BEPerOiWKUxcjz4MKG7Bw6erx4VxjxBGDBXOELZnP9G3LrnMujKoTC | |
Rig3Ffug3Pclr5bu04wtZ83sGZT2KX1qszwBX9kT0dOd3tAk4HmU0Kq95lc30pNA | |
zvJ01SfMlaolQ0YCkK1Bqe3d9HqNnv0zNILtJzNGZKJSos4iJPv+nAdwEQXVZWNt | |
wwdhnHLDwhMo9WKqnONTou8xKisIZfnkznb1bTAEZh/axAsVVertKQ+HryDtM+xC | |
PWpj4OUz0nctcb2CvAYdz+Q+csr4Fsku/8tPELJBX4Z42D1j34zWJa8CZZHIds79 | |
luHHZdOOoLubLWs2tyKJPTirDPOPspp8uESDTDOIjtH9uIYPD8SgSWeVeBiikelM | |
VFKYbOmnT1ACYAwpyKOEnxN5BHtIiz6MPxAwIWLJdEduHqm5nAJYBDWgkdepWzMb | |
urlN0OvqicC/+5KuJGl0CDJyhZAeeYwP+eu8kmrIKfTPy0fn4W4VsIjOKwnD4ekB | |
XDL42/7b1/+HsRc8lPMKMBX3gFR6ikzcSL0qHXc8sesjwkjXNznqgdeXNwIDAQAB | |
AoICAEUnUPieTOIGgnVnplmk0+xBNjCCncOxlGEWLQvTkrJmgHOuZK7I8ENk34uQ | |
CCwYNv38GvtwsXGbjtCHwFa5anl7Ypil8d0JyuRezOBxh++sf5vHPowng7nQUW31 | |
qh0g4jYbpp0Tn+MTI43L3w8xx2bbNw3nO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vGEqbqxrZfLms6ID+1cE2A7WOcm8DeZvqN22aykcVQID | |
ogKgJ+SJlXMLAdjxcmzGKnWcooguqITJM0wSqP5n63ICY1Wvb4Yoh2w9Zq48miAc | |
D776HivoPjoEYVgZsN7t2i4DVCRyyr15jC1BkteTQ5osVrSBc3GUTFTyPFcXjcg8 | |
fmCt0al7u05hwkb/Mg01UJw0NAt/G1dJQQ98VBf7wMLsjbBqKBMuzsxt | |
-----END RSA PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-----BEGIN PUBLIC KEY----- | |
MIICITANBgkqhkiG9w0BAQEFAAOCAg4AMIICCQKCAgBoe2f+iDWW+xMsnKeL31ZR | |
xPw0Gvj8Eku8MTWkFwISRF7vwepxJWHGs2Ud/v7BZwh+aPlhp32n5JI431/XW/BF | |
cGk3bS3tYkUBEP+cpwWJe9UDaQwNwF3eg4WWb6BEPerOiWKUxcjz4MKG7Bw6erx4 | |
VxjxBGDBXOELZnP9G3LrnMujKoTCRig3Ffug3Pclr5bu04wtZ83sGZT2KX1qszwB | |
X9kT0dOd3tAk4HmU0Kq95lc30pNAzvJ01SfMlaolQ0YCkK1Bqe3d9HqNnv0zNILt | |
JzNGZKJSos4iJPv+nAdwEQXVZWNtwwdhnHLDwhMo9WKqnONTou8xKisIZfnkznb1 | |
bTAEZh/axAsVVertKQ+HryDtM+xCPWpj4OUz0nctcb2CvAYdz+Q+csr4Fsku/8tP | |
ELJBX4Z42D1j34zWJa8CZZHIds79luHHZdOOoLubLWs2tyKJPTirDPOPspp8uESD | |
TDOIjtH9uIYPD8SgSWeVeBiikelMVFKYbOmnT1ACYAwpyKOEnxN5BHtIiz6MPxAw | |
IWLJdEduHqm5nAJYBDWgkdepWzMburlN0OvqicC/+5KuJGl0CDJyhZAeeYwP+eu8 | |
kmrIKfTPy0fn4W4VsIjOKwnD4ekBXDL42/7b1/+HsRc8lPMKMBX3gFR6ikzcSL0q | |
HXc8sesjwkjXNznqgdeXNwIDAQAB | |
-----END PUBLIC KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('selfEncrypt')) { | |
function selfEncrypt($value = null, $private = true) | |
{ | |
$result = null; | |
if ($private) { | |
if (file_exists(base_path('.private'))) { | |
$file = file_get_contents(base_path('.private')); | |
if (!$file) { | |
return null; | |
} | |
openssl_private_encrypt($value, $result, $file); | |
} | |
} else { | |
if (file_exists(base_path('.public'))) { | |
$file = file_get_contents(base_path('.public')); | |
if (!$file) { | |
return null; | |
} | |
openssl_public_encrypt($value, $result, $file); | |
} | |
} | |
return base64_encode($result); | |
} | |
} | |
if (!function_exists('selfDecrypt')) { | |
function selfDecrypt($value = null, $private = true) | |
{ | |
$value = base64_decode($value); | |
$result = null; | |
if ($private) { | |
if (file_exists(base_path('.public'))) { | |
$file = file_get_contents(base_path('.public')); | |
if (!$file) { | |
return null; | |
} | |
openssl_public_decrypt($value, $result, $file); | |
} | |
} else { | |
if (file_exists(base_path('.private'))) { | |
$file = file_get_contents(base_path('.private')); | |
if (!$file) { | |
return null; | |
} | |
} | |
openssl_private_decrypt($value, $result, $file); | |
} | |
return $result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RSA KEY GENERATOR