mirror of
https://github.com/chatmail/core.git
synced 2026-05-03 13:26:28 +03:00
Move part of test_encryption_decryption to key.rs
This commit is contained in:
21
src/key.rs
21
src/key.rs
@@ -439,6 +439,27 @@ i8pcjGO+IZffvyZJVRWfVooBJmWWbPB1pueo3tx8w3+fcuzpxz+RLFKaPyqXO+dD
|
|||||||
assert_eq!(private_key, private_key2);
|
assert_eq!(private_key, private_key2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_from_slice_bad_data() {
|
||||||
|
let mut bad_data: [u8; 4096] = [0; 4096];
|
||||||
|
|
||||||
|
for i in 0..4096 {
|
||||||
|
bad_data[i] = (i & 0xff) as u8;
|
||||||
|
}
|
||||||
|
|
||||||
|
for j in 0..(4096 / 40) {
|
||||||
|
let bad_key = Key::from_slice(
|
||||||
|
&bad_data[j..j + 4096 / 2 + j],
|
||||||
|
if 0 != j & 1 {
|
||||||
|
KeyType::Public
|
||||||
|
} else {
|
||||||
|
KeyType::Private
|
||||||
|
},
|
||||||
|
);
|
||||||
|
assert!(bad_key.is_none());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore] // is too expensive
|
#[ignore] // is too expensive
|
||||||
fn test_ascii_roundtrip() {
|
fn test_ascii_roundtrip() {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use deltachat::contact::*;
|
|||||||
use deltachat::context::*;
|
use deltachat::context::*;
|
||||||
use deltachat::dc_imex::*;
|
use deltachat::dc_imex::*;
|
||||||
use deltachat::dc_tools::*;
|
use deltachat::dc_tools::*;
|
||||||
use deltachat::key::*;
|
|
||||||
use deltachat::keyring::*;
|
use deltachat::keyring::*;
|
||||||
use deltachat::oauth2::*;
|
use deltachat::oauth2::*;
|
||||||
use deltachat::pgp::*;
|
use deltachat::pgp::*;
|
||||||
@@ -461,24 +460,6 @@ unsafe fn stress_functions(context: &Context) {
|
|||||||
#[test]
|
#[test]
|
||||||
#[ignore] // is too expensive
|
#[ignore] // is too expensive
|
||||||
fn test_encryption_decryption() {
|
fn test_encryption_decryption() {
|
||||||
let mut bad_data: [u8; 4096] = [0; 4096];
|
|
||||||
|
|
||||||
for i in 0..4096 {
|
|
||||||
bad_data[i] = (i & 0xff) as u8;
|
|
||||||
}
|
|
||||||
|
|
||||||
for j in 0..(4096 / 40) {
|
|
||||||
let bad_key = Key::from_slice(
|
|
||||||
&bad_data[j..j + 4096 / 2 + j],
|
|
||||||
if 0 != j & 1 {
|
|
||||||
KeyType::Public
|
|
||||||
} else {
|
|
||||||
KeyType::Private
|
|
||||||
},
|
|
||||||
);
|
|
||||||
assert!(bad_key.is_none());
|
|
||||||
}
|
|
||||||
|
|
||||||
let (public_key, private_key) = dc_pgp_create_keypair("foo@bar.de").unwrap();
|
let (public_key, private_key) = dc_pgp_create_keypair("foo@bar.de").unwrap();
|
||||||
|
|
||||||
private_key.split_key().unwrap();
|
private_key.split_key().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user