libsm
libsm copied to clipboard
sm2 解密时,如果密文格式不正确,会导致 panic
pub fn decrypt(&self, cipher: &[u8]) -> Sm2Result<Vec<u8>>
方法
转 c_1_point 时,如果遇到异常能否“透传”出来?
最好 let c_1_point = self.curve.bytes_to_point(c_1_bytes).unwrap();
这里可以不要直接 unwrap(),
能把这里的异常也 return 出来。
现在,这里面的 Sm2Error::InvalidPublic
Sm2Error::NotOnCurve
等,外层好像没法处理。