int main(int argc, char *argv[]) {
if (sodium_init() != 0) {
return 1;
}
if (encrypt("./encrypted", "./original", "key") != 0) {
return 1;
}
if (decrypt("./decrypted", "./encrypted1", "key") != 0) {
return 1;
}
return 0;
return 0;
}
The example above works great. However, if I try to encrypt first (and comment out the decrypt) and then try to decrypt (and comment out the encrypt), it fails. I'm using the same key. Any idea as to why it doesn't work even when invoked with the same key? What I mean to ask is that, how can I split these 2 function calls across to separate invocations instead of them being in a single file? I think the example should reflect that.
I'm working with the encryption and decryption samples as mentioned here: https://libsodium.gitbook.io/doc/secret-key_cryptography/secretstream#file-encryption-example-code
My code:
The example above works great. However, if I try to encrypt first (and comment out the decrypt) and then try to decrypt (and comment out the encrypt), it fails. I'm using the same key. Any idea as to why it doesn't work even when invoked with the same key? What I mean to ask is that, how can I split these 2 function calls across to separate invocations instead of them being in a single file? I think the example should reflect that.
Thanks.