1pub mod serialization;
2pub mod symmetric;
3
4macro_rules! cipher {
5 ($name:ident, $cipher:path, $scheme:path) => {
6 #[derive(Debug, Default)]
7 pub struct $name;
8 impl crate::symmetric::encryption::Encryption for $name {
9 type Cipher = $cipher;
10 type Scheme = $scheme;
11 }
12 };
13}
14
15#[cfg(all(feature = "aes256gcm", feature = "bitcode"))]
16pub type DefaultScheme = Aes256GcmBitcode;
17
18#[cfg(all(feature = "aes128gcm", feature = "bitcode"))]
19cipher!(
20 Aes128GcmBitcode,
21 aes_gcm::Aes128Gcm,
22 crate::serialization::bitcode::Bitcode
23);
24#[cfg(all(feature = "aes128gcmsiv", feature = "bitcode"))]
25cipher!(
26 Aes128GcmSivBitcode,
27 aes_gcm_siv::Aes128GcmSiv,
28 crate::serialization::bitcode::Bitcode
29);
30#[cfg(all(feature = "aes256gcm", feature = "bitcode"))]
31cipher!(
32 Aes256GcmBitcode,
33 aes_gcm::Aes256Gcm,
34 crate::serialization::bitcode::Bitcode
35);
36#[cfg(all(feature = "aes256gcmsiv", feature = "bitcode"))]
37cipher!(
38 Aes256GcmSivBitcode,
39 aes_gcm_siv::Aes256GcmSiv,
40 crate::serialization::bitcode::Bitcode
41);
42#[cfg(all(feature = "chacha8poly1305", feature = "bitcode"))]
43cipher!(
44 ChaCha8Poly1305Bitcode,
45 chacha20poly1305::ChaCha8Poly1305,
46 crate::serialization::bitcode::Bitcode
47);
48#[cfg(all(feature = "xchacha8poly1305", feature = "bitcode"))]
49cipher!(
50 XChaCha8Poly1305Bitcode,
51 chacha20poly1305::XChaCha8Poly1305,
52 crate::serialization::bitcode::Bitcode
53);
54#[cfg(all(feature = "chacha12poly1305", feature = "bitcode"))]
55cipher!(
56 ChaCha12Poly1305Bitcode,
57 chacha20poly1305::ChaCha12Poly1305,
58 crate::serialization::bitcode::Bitcode
59);
60#[cfg(all(feature = "xchacha12poly1305", feature = "bitcode"))]
61cipher!(
62 XChaCha12Poly1305Bitcode,
63 chacha20poly1305::XChaCha12Poly1305,
64 crate::serialization::bitcode::Bitcode
65);
66#[cfg(all(feature = "chacha20poly1305", feature = "bitcode"))]
67cipher!(
68 ChaCha20Poly1305Bitcode,
69 chacha20poly1305::ChaCha20Poly1305,
70 crate::serialization::bitcode::Bitcode
71);
72#[cfg(all(feature = "xchacha20poly1305", feature = "bitcode"))]
73cipher!(
74 XChaCha20Poly1305Bitcode,
75 chacha20poly1305::XChaCha20Poly1305,
76 crate::serialization::bitcode::Bitcode
77);
78#[cfg(all(feature = "aes128gcm", feature = "bincode"))]
79cipher!(
80 Aes128GcmBincode,
81 aes_gcm::Aes128Gcm,
82 crate::serialization::bincode::Bincode
83);
84#[cfg(all(feature = "aes128gcmsiv", feature = "bincode"))]
85cipher!(
86 Aes128GcmSivBincode,
87 aes_gcm_siv::Aes128GcmSiv,
88 crate::serialization::bincode::Bincode
89);
90#[cfg(all(feature = "aes256gcm", feature = "bincode"))]
91cipher!(
92 Aes256GcmBincode,
93 aes_gcm::Aes256Gcm,
94 crate::serialization::bincode::Bincode
95);
96#[cfg(all(feature = "aes256gcmsiv", feature = "bincode"))]
97cipher!(
98 Aes256GcmSivBincode,
99 aes_gcm_siv::Aes256GcmSiv,
100 crate::serialization::bincode::Bincode
101);
102#[cfg(all(feature = "chacha8poly1305", feature = "bincode"))]
103cipher!(
104 ChaCha8Poly1305Bincode,
105 chacha20poly1305::ChaCha8Poly1305,
106 crate::serialization::bincode::Bincode
107);
108#[cfg(all(feature = "xchacha8poly1305", feature = "bincode"))]
109cipher!(
110 XChaCha8Poly1305Bincode,
111 chacha20poly1305::XChaCha8Poly1305,
112 crate::serialization::bincode::Bincode
113);
114#[cfg(all(feature = "chacha12poly1305", feature = "bincode"))]
115cipher!(
116 ChaCha12Poly1305Bincode,
117 chacha20poly1305::ChaCha12Poly1305,
118 crate::serialization::bincode::Bincode
119);
120#[cfg(all(feature = "xchacha12poly1305", feature = "bincode"))]
121cipher!(
122 XChaCha12Poly1305Bincode,
123 chacha20poly1305::XChaCha12Poly1305,
124 crate::serialization::bincode::Bincode
125);
126#[cfg(all(feature = "chacha20poly1305", feature = "bincode"))]
127cipher!(
128 ChaCha20Poly1305Bincode,
129 chacha20poly1305::ChaCha20Poly1305,
130 crate::serialization::bincode::Bincode
131);
132#[cfg(all(feature = "xchacha20poly1305", feature = "bincode"))]
133cipher!(
134 XChaCha20Poly1305Bincode,
135 chacha20poly1305::XChaCha20Poly1305,
136 crate::serialization::bincode::Bincode
137);