()
| 769 | |
| 770 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 771 | async fn test_decryption_error_msg() -> Result<()> { |
| 772 | let mut tcm = TestContextManager::new(); |
| 773 | let alice = &tcm.alice().await; |
| 774 | let bob = &tcm.bob().await; |
| 775 | |
| 776 | let plain = Vec::from(b"this is the secret message"); |
| 777 | let pk_for_encryption = load_self_public_key(alice).await?; |
| 778 | |
| 779 | // Encrypt a message, but only to self, not to Bob: |
| 780 | let compress = true; |
| 781 | let ctext = pk_encrypt( |
| 782 | plain, |
| 783 | vec![pk_for_encryption], |
| 784 | KEYS.alice_secret.clone(), |
| 785 | compress, |
| 786 | SeipdVersion::V2, |
| 787 | ) |
| 788 | .await?; |
| 789 | |
| 790 | // Trying to decrypt it should fail with an OK error message: |
| 791 | let bob_private_keyring = crate::key::load_self_secret_keyring(bob).await?; |
| 792 | let error = decrypt_bytes(ctext.into(), &bob_private_keyring, &[]) |
| 793 | .await |
| 794 | .unwrap_err(); |
| 795 | |
| 796 | assert_eq!(format!("{error:#}"), "decrypt_with_keys: missing key"); |
| 797 | |
| 798 | Ok(()) |
| 799 | } |
| 800 | |
| 801 | /// Tests that recipient key IDs and fingerprints |
| 802 | /// are omitted or replaced with wildcards. |
nothing calls this directly
no test coverage detected