-2

I've encrypted a message through someone else's public key using crypto_box_seal. The recipient can decrypt it without any problems using their own keypair.

if(crypto_box_seal_open(decryptedMessage, [ciphertextDataDerived mutableBytes], [ciphertextDataDerived length], [pubkey bytes], [privkey bytes]) != 0){
   NSLog(@"Oops! Error on decryption");
} else {
   NSUInteger sizeDecrypted = sizeof(decryptedMessage);
   NSData* dataDecrypted = [NSData dataWithBytes:(const void *)decryptedMessage length:sizeof(unsigned char)*sizeDecrypted];
   NSString *decryptedString = [[NSString alloc] initWithData:dataDecrypted encoding:NSUTF8StringEncoding];
   NSLog(@"Decrypted Message: %@", decryptedString);
}

But is it also possible to decrypt my own message. If so, how? I've tried decrypting it using my own public and private keys but it just fails.

rmaddy
  • 314,917
  • 42
  • 532
  • 579

1 Answers1

0

If it were practically possible to decrypt a message using anything other than the recipient's private key, this would be a sign that the entire planet's software security was essentially null and void. So, no, it is not possible to decrypt your original message unless the recipient discloses their private key to you, which of course they should never do.

davidf2281
  • 1,319
  • 12
  • 20