pub struct RsaOaepCrypter { /* private fields */ }Expand description
RSA-OAEP 非对称加密器(基于 RustCrypto rsa crate)
使用 RSA-OAEP with SHA-256 和 MGF1-SHA256 填充方案。 公钥加密,私钥解密,适用于小数据(如密钥交换、短消息加密)。
Implementations§
Source§impl RsaOaepCrypter
impl RsaOaepCrypter
Sourcepub fn generate(key_bits: usize) -> Result<Self, CryptoError>
pub fn generate(key_bits: usize) -> Result<Self, CryptoError>
生成新的 RSA 密钥对(指定位数,推荐 2048 或 3072)
Sourcepub fn from_keys(public_key: RsaPublicKey, private_key: RsaPrivateKey) -> Self
pub fn from_keys(public_key: RsaPublicKey, private_key: RsaPrivateKey) -> Self
从已有密钥对创建
Sourcepub fn public_key(&self) -> &RsaPublicKey
pub fn public_key(&self) -> &RsaPublicKey
返回公钥引用
Sourcepub fn private_key(&self) -> &RsaPrivateKey
pub fn private_key(&self) -> &RsaPrivateKey
返回私钥引用
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RsaOaepCrypter
impl RefUnwindSafe for RsaOaepCrypter
impl Send for RsaOaepCrypter
impl Sync for RsaOaepCrypter
impl Unpin for RsaOaepCrypter
impl UnsafeUnpin for RsaOaepCrypter
impl UnwindSafe for RsaOaepCrypter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more