Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
dghbc committed Jan 14, 2019
1 parent 6ca2f2f commit fcb6276
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions crypto/test/src/cmp/test/ProtectedMessageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void TestSampleCr()



IsTrue(msg.Verify(new Asn1MacFactoryProvider(),Strings.ToAsciiByteArray("TopSecret1234")));
IsTrue(msg.Verify(new PKMacBuilder(), "TopSecret1234".ToCharArray()));

}

Expand Down Expand Up @@ -293,17 +293,10 @@ public void TestMacProtectedMessage()
// 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()));
}


Expand Down Expand Up @@ -356,12 +349,7 @@ public void TestVerifyBCJavaGeneratedMessage()

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()));
}


Expand Down

0 comments on commit fcb6276

Please sign in to comment.