|
1 | | -//! Generic traits for message encryption and decryption |
| 1 | +//! RSA-related trait definitions. |
2 | 2 |
|
3 | | -use alloc::vec::Vec; |
4 | | -use rand_core::CryptoRngCore; |
| 3 | +mod encryption; |
| 4 | +pub(crate) mod keys; |
| 5 | +mod padding; |
5 | 6 |
|
6 | | -use crate::errors::Result; |
7 | | - |
8 | | -/// Encrypt the message using provided random source |
9 | | -pub trait RandomizedEncryptor { |
10 | | - /// Encrypt the given message. |
11 | | - fn encrypt_with_rng<R: CryptoRngCore + ?Sized>( |
12 | | - &self, |
13 | | - rng: &mut R, |
14 | | - msg: &[u8], |
15 | | - ) -> Result<Vec<u8>>; |
16 | | -} |
17 | | - |
18 | | -/// Decrypt the given message |
19 | | -pub trait Decryptor { |
20 | | - /// Decrypt the given message. |
21 | | - fn decrypt(&self, ciphertext: &[u8]) -> Result<Vec<u8>>; |
22 | | -} |
23 | | - |
24 | | -/// Decrypt the given message using provided random source |
25 | | -pub trait RandomizedDecryptor { |
26 | | - /// Decrypt the given message. |
27 | | - fn decrypt_with_rng<R: CryptoRngCore + ?Sized>( |
28 | | - &self, |
29 | | - rng: &mut R, |
30 | | - ciphertext: &[u8], |
31 | | - ) -> Result<Vec<u8>>; |
32 | | -} |
33 | | - |
34 | | -/// Encryption keypair with an associated encryption key. |
35 | | -pub trait EncryptingKeypair { |
36 | | - /// Encrypting key type for this keypair. |
37 | | - type EncryptingKey: Clone; |
38 | | - |
39 | | - /// Get the encrypting key which can encrypt messages to be decrypted by |
40 | | - /// the decryption key portion of this keypair. |
41 | | - fn encrypting_key(&self) -> Self::EncryptingKey; |
42 | | -} |
| 7 | +pub use encryption::{Decryptor, EncryptingKeypair, RandomizedDecryptor, RandomizedEncryptor}; |
| 8 | +pub use keys::{PrivateKeyParts, PublicKeyParts}; |
| 9 | +pub use padding::{PaddingScheme, SignatureScheme}; |
0 commit comments