pub struct SecureUtil;Expand description
加解密工具,摘要算法等也归集次此工具类中
Implementations§
Source§impl SecureUtil
impl SecureUtil
Sourcepub fn aes_random_key() -> String
pub fn aes_random_key() -> String
TODO 待完善
Sourcepub fn aes_encode(bytes: &[u8], key: &str) -> String
pub fn aes_encode(bytes: &[u8], key: &str) -> String
TODO 待完善
Sourcepub fn rsa_random_key() -> (RsaPublicKey, RsaPrivateKey)
pub fn rsa_random_key() -> (RsaPublicKey, RsaPrivateKey)
Sourcepub fn rsa_encode(pub_key: &RsaPublicKey, bytes: &[u8]) -> Vec<u8> ⓘ
pub fn rsa_encode(pub_key: &RsaPublicKey, bytes: &[u8]) -> Vec<u8> ⓘ
Sourcepub fn rsa_decode(priv_key: &RsaPrivateKey, enc_data: &[u8]) -> Vec<u8> ⓘ
pub fn rsa_decode(priv_key: &RsaPrivateKey, enc_data: &[u8]) -> Vec<u8> ⓘ
Sourcepub fn rsa_private_key_to_pkcs8(priv_key: &RsaPrivateKey) -> String
pub fn rsa_private_key_to_pkcs8(priv_key: &RsaPrivateKey) -> String
Sourcepub fn rsa_public_key_to_pkcs8(pub_key: &RsaPublicKey) -> String
pub fn rsa_public_key_to_pkcs8(pub_key: &RsaPublicKey) -> String
Sourcepub fn rsa_private_key_from_pkcs8(pkcs8_string: &str) -> RsaPrivateKey
pub fn rsa_private_key_from_pkcs8(pkcs8_string: &str) -> RsaPrivateKey
Sourcepub fn rsa_public_key_from_pkcs8(pkcs8_string: &str) -> RsaPublicKey
pub fn rsa_public_key_from_pkcs8(pkcs8_string: &str) -> RsaPublicKey
Sourcepub fn sha256_string(bytes: &[u8]) -> String
pub fn sha256_string(bytes: &[u8]) -> String
pub fn md5_string(bytes: &[u8]) -> String
Sourcepub fn base64_encode(bytes: &[u8]) -> String
pub fn base64_encode(bytes: &[u8]) -> String
Sourcepub fn base64_decode(base64_str: &str) -> Result<Vec<u8>, DecodeError>
pub fn base64_decode(base64_str: &str) -> Result<Vec<u8>, DecodeError>
Sourcepub fn to_md5_str(bytes: &[u8]) -> String
👎Deprecated: This function is deprecated, please use md5_string instead
pub fn to_md5_str(bytes: &[u8]) -> String
Auto Trait Implementations§
impl Freeze for SecureUtil
impl RefUnwindSafe for SecureUtil
impl Send for SecureUtil
impl Sync for SecureUtil
impl Unpin for SecureUtil
impl UnwindSafe for SecureUtil
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