public void ParseRsa_handles_modes_4() { var cs = CipherString.ParseRsa($"4.{RsaCiphertextBase64}"); Assert.Equal(CipherMode.Rsa2048OaepSha1, cs.Mode); Assert.Empty(cs.Iv); Assert.Equal(RsaCiphertext, cs.Ciphertext); Assert.Empty(cs.Mac); }
public void ParseRsa_handles_modes_6_without_mac() { var cs = CipherString.ParseRsa($"6.{RsaCiphertextBase64}"); Assert.Equal(CipherMode.Rsa2048OaepSha1HmacSha256, cs.Mode); Assert.Empty(cs.Iv); Assert.Equal(RsaCiphertext, cs.Ciphertext); Assert.All(cs.Mac, x => Assert.Equal(0, x)); }
public void ParseRsa_handles_default_mode() { var cs = CipherString.ParseRsa(RsaCiphertextBase64); Assert.Equal(CipherMode.Rsa2048OaepSha256, cs.Mode); Assert.Empty(cs.Iv); Assert.Equal(RsaCiphertext, cs.Ciphertext); Assert.Empty(cs.Mac); }
public void ParseRsa_throws_on_valid_non_rsa_input() { Exceptions.AssertThrowsInternalError( () => CipherString.ParseRsa("0.aXZpdml2aXZpdml2aXZpdg==|Y2lwaGVydGV4dA=="), "Invalid RSA cipher string format"); }
public void ParseRsa_throws_on_malformed_input() { Exceptions.AssertThrowsInternalError(() => CipherString.ParseRsa(".."), "Invalid/unsupported cipher string format"); }