pub struct WxOpenCryptUtils { /* private fields */ }Expand description
开放平台(第三方平台)回调消息加解密工具。
Implementations§
Source§impl WxOpenCryptUtils
impl WxOpenCryptUtils
Sourcepub fn new(config: &dyn WxOpenConfigStorage) -> Result<Self, String>
pub fn new(config: &dyn WxOpenConfigStorage) -> Result<Self, String>
Sourcepub fn decrypt_xml(
&self,
msg_signature: &str,
timestamp: &str,
nonce: &str,
encrypted_xml: &str,
) -> Result<String, String>
pub fn decrypt_xml( &self, msg_signature: &str, timestamp: &str, nonce: &str, encrypted_xml: &str, ) -> Result<String, String>
解密第三方平台推送的加密消息(xml 格式)。
对应 Java WxCryptUtil.decryptXml(msgSignature, timestamp, nonce, encryptedXml)。
Sourcepub fn decrypt_content(
&self,
msg_signature: &str,
timestamp: &str,
nonce: &str,
cipher_text: &str,
) -> Result<String, String>
pub fn decrypt_content( &self, msg_signature: &str, timestamp: &str, nonce: &str, cipher_text: &str, ) -> Result<String, String>
验证签名后直接解密密文内容(对应 Java decryptContent)。
Sourcepub fn encrypt(&self, plain_xml: &str) -> Result<String, String>
pub fn encrypt(&self, plain_xml: &str) -> Result<String, String>
将待回复消息加密打包为带签名的 xml(对应 Java encrypt)。
Sourcepub fn encrypt_context(&self, plain_xml: &str) -> Result<EncryptContext, String>
pub fn encrypt_context(&self, plain_xml: &str) -> Result<EncryptContext, String>
将待回复消息加密打包,返回加密所需值对象(对应 Java encryptContext)。
Trait Implementations§
Source§impl Clone for WxOpenCryptUtils
impl Clone for WxOpenCryptUtils
Source§fn clone(&self) -> WxOpenCryptUtils
fn clone(&self) -> WxOpenCryptUtils
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for WxOpenCryptUtils
impl RefUnwindSafe for WxOpenCryptUtils
impl Send for WxOpenCryptUtils
impl Sync for WxOpenCryptUtils
impl Unpin for WxOpenCryptUtils
impl UnsafeUnpin for WxOpenCryptUtils
impl UnwindSafe for WxOpenCryptUtils
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