Udi*_*sio 5 php openssl rsa encryption-asymmetric private-key
我需要使用RSA,PKCS1,私钥和PHP加密字符串.我甚至找不到可以与exec()一起使用的终端命令.有谁知道怎么做?
谢谢!
小智 5
<?php
include('Crypt/RSA.php');
$rsa = new Crypt_RSA();
//extract($rsa->createKey());
$plaintext = 'terrafrost';
$rsa->loadKey($privatekey);
$rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
$ciphertext = $rsa->encrypt($plaintext);
echo $plaintext;
?>
Run Code Online (Sandbox Code Playgroud)
安全警告:如果您要使用phpseclib,请确保遵循RSA加密的最佳做法.有关更多详细信息和替代方法,请参阅此答案.
openssl aes-256-cbc -a -salt -in inputfile.txt -out encryptedfile.txt -pass pass:thepassword
openssl aes-256-cbc -d -a -in encryptedfile.txt -out decryptedfile.txt
Run Code Online (Sandbox Code Playgroud)
可以执行这些,并且应该能够根据需要更改密码。
归档时间: |
|
查看次数: |
10904 次 |
最近记录: |