As referring to this link http://blog.iamzsx.me/show.html?id=155002, I generated a pair of key using
$ openssl req -x509 -out public_key.der -outform der -new -newkey rsa:1024 -keyout private_key.pem -days 3650
this command. Then I get private_key.pem
& public_key.der
.
I follow the implementation what I get the encrypted data is
<ceaedf05 f39b69ab 8618f859 599926e9 c18d9233 342c58e0 534b66af 8b33dda3 375d6a11 b95ad821 11549637 ce4c26dc 760169c6 04096aff 9ec48938 1c6b149f 8180f9bb 8e1337ce 2b492af2 e0464e4c 9ab7aabd 9da53caf 1b5e5277 3c708b43 cb6515ee c9a18b02 4941416c 7f1e36d3 dcd3705b 66f8a159 ab8a7a3f a9db8306>
but what I want is
dXXEEADvRDdk4QVM6TU9dyYtuHe8RVzP3KsWAoDDSQ2w+NELVPOv4mSVW1jIhEhb+pLsmOvLzGIW1/2qkp91M1UoPuhgplV2JEgP8EvcBn8EY43n7wVASGP9heRK0lYMfENP54f35+GFP68nU5zbrmX0IN6DGGGSNdSewzLb6s4=
Actually what I want is the functions below:
in iOS:
- (NSString *)encryptedString:(NSString *)plainText
in PHP:
function decrypted_string()
{
$encrypted_string = $_POST['encrypted_string'];
// implementation
return $plain_text;
}
How can I implement these functions?
I already googled for it, unfortunately, there is no solution that I want. Hopefully can get help in here. Thanks in advance.