public static SqlString Unprotect(byte[] protectedBlob) { var dp = new DataProtector(x509); var decrypt = dp.UnprotectBuffer(protectedBlob); return(new SqlString(decrypt)); }
public void TestProtectNullString() { var dt = new DataProtector(_cert); var bytes = dt.ProtectBuffer(null); var unencrypted = dt.UnprotectBuffer(bytes); Assert.Null(unencrypted); }
public void TestProtectEmptyString() { var dt = new DataProtector(_cert); var bytes = dt.ProtectBuffer(String.Empty); var unencrypted = dt.UnprotectBuffer(bytes); Assert.Equal(String.Empty, unencrypted); }
public void TestProtectUnProtect(string clearText) { var dt = new DataProtector(_cert); var bytes = dt.ProtectBuffer(clearText); var unencrypted = dt.UnprotectBuffer(bytes); Assert.Equal(clearText, unencrypted); }