Closed jcrodriguez1989 closed 1 year ago
It makes no sense to use base64_decode(to_encrypt)
, you should only use base64_decode
to decode a string in base64 format, which you have previously encoded with base64_encode()
. What are you trying to do? This works:
library(openssl)
keys <- rsa_keygen()
to_encrypt <- "some_message_to_encrypt"
encrypted_msg <- charToRaw(to_encrypt) |>
rsa_encrypt(keys$pubkey) |>
base64_encode()
base64_decode(encrypted_msg) |>
rsa_decrypt(keys) |>
rawToChar()
Awesome! Thanks @jeroen ,
I thought that, in openssl, we used base64_decode
/base64_encode
instead of charToRaw
/rawToChar
.
It is completely clear now.
Thanks!
Am I doing something wrong here?
With this message
to_encrypt
I get an error:With this message I get a different decrypted message: