public void HappyPath_EncryptAndThenDecrypt(string value) { var e = new Encrypt { PublicKey = publicKey, PrivateKey = privateKey }; WrappedValue wrapped = e.EncryptAndWrap(value); Assert.NotNull(wrapped); Assert.NotNull(wrapped.EncryptedAESKey); Assert.NotNull(wrapped.IV); Assert.NotNull(wrapped.EncryptedValue); string wrapHexed = wrapped.ToString(); Assert.NotNull(wrapHexed); Assert.NotEqual(string.Empty, wrapHexed); WrappedValue unhexedWrap = null; try { unhexedWrap = new WrappedValue(wrapHexed); } catch { // no-op } Assert.NotNull(unhexedWrap); Assert.Equal(wrapped.EncryptedValue, unhexedWrap.EncryptedValue); string decryptedValue = e.UnwrapAndDecrypt(unhexedWrap); Assert.NotNull(decryptedValue); Assert.Equal(value, decryptedValue); }
public override string ToString() { return(WrappedValue.ToString()); }
public override string ToString() { return(WrappedValue?.ToString() ?? ""); }