diff options
author | David Hook <dgh@bouncycastle.org> | 2019-01-15 09:35:28 +1100 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2019-01-15 09:35:28 +1100 |
commit | fcb62761a47c1010fd4dc5412493ef372a630310 (patch) | |
tree | 8b8749c30f4d6776bf2fa197a8c7851f0b1add08 | |
parent | refactor of PKMacBuilder (diff) | |
download | BouncyCastle.NET-ed25519-fcb62761a47c1010fd4dc5412493ef372a630310.tar.xz |
updated
-rw-r--r-- | crypto/test/src/cmp/test/ProtectedMessageTest.cs | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/crypto/test/src/cmp/test/ProtectedMessageTest.cs b/crypto/test/src/cmp/test/ProtectedMessageTest.cs index c22ba3297..569ba6c7b 100644 --- a/crypto/test/src/cmp/test/ProtectedMessageTest.cs +++ b/crypto/test/src/cmp/test/ProtectedMessageTest.cs @@ -174,7 +174,7 @@ namespace Org.BouncyCastle.Cmp.Tests - IsTrue(msg.Verify(new Asn1MacFactoryProvider(),Strings.ToAsciiByteArray("TopSecret1234"))); + IsTrue(msg.Verify(new PKMacBuilder(), "TopSecret1234".ToCharArray())); } @@ -293,17 +293,10 @@ namespace Org.BouncyCastle.Cmp.Tests // Default instance. // + PKMacBuilder macFactory = new PKMacBuilder(); + ProtectedPkiMessage msg = msgBuilder.Build(macFactory.Build("testpass".ToCharArray())); - PkMacFactory macFactory = new PkMacFactory(new SecureRandom()); - macFactory.Password = Strings.ToAsciiByteArray("testpass"); - ProtectedPkiMessage msg = msgBuilder.Build(macFactory); - - - MacVerifierFactory verifierFactory = new MacVerifierFactory( - new PkMacFactory((PbmParameter) msg.Header.ProtectionAlg.Parameters) - {Password = Strings.ToAsciiByteArray("testpass")} - ); - IsTrue(msg.Verify(verifierFactory)); + IsTrue(msg.Verify(macFactory, "testpass".ToCharArray())); } @@ -356,12 +349,7 @@ namespace Org.BouncyCastle.Cmp.Tests PbmParameter pbmParameters = PbmParameter.GetInstance(pkiMsg.Header.ProtectionAlg.Parameters); - MacVerifierFactory verifierFactory = new MacVerifierFactory(new PkMacFactory(pbmParameters) - { - Password = Strings.ToAsciiByteArray("secret") - }); - - IsTrue(pkiMsg.Verify(verifierFactory)); + IsTrue(pkiMsg.Verify(new PKMacBuilder().SetParameters(pbmParameters), "secret".ToCharArray())); } |