public void EncryptDecrypt(string originalString, SM2Mode mode) { var encStr = SM2EncryptionProvider.EncryptByPublicKey(originalString, PubKey, mode: mode); var decodedStr = SM2EncryptionProvider.DecryptByPrivateKey(encStr, PriKey, mode: mode); Assert.Equal(originalString, decodedStr); }
public void EncryptDecryptWithGenKey(string originalString, SM2Mode mode) { var key = SM2EncryptionProvider.CreateKey(); var encStr = SM2EncryptionProvider.EncryptByPublicKey(originalString, key.PublicKey, mode: mode); var decodedStr = SM2EncryptionProvider.DecryptByPrivateKey(encStr, key.PrivateKey, mode: mode); Assert.Equal(originalString, decodedStr); }