Skip to content

Commit

Permalink
added use of IKeyWrapper for managing CMS KeyTransRecipient
Browse files Browse the repository at this point in the history
  • Loading branch information
dghbc committed Jan 18, 2019
1 parent 714e5ef commit e0d1810
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crypto/test/src/crmf/test/CrmfTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
using Org.BouncyCastle.Utilities.Encoders;
using Org.BouncyCastle.Utilities.Test;
using Org.BouncyCastle.X509;
using Org.BouncyCastle.Operators;

namespace Org.BouncyCastle.Crmf.Tests
{
Expand Down Expand Up @@ -114,12 +115,8 @@ public void TestBasicMessageWithArchiveControl()

certificateRequestMessageBuilder.AddControl(
new PKIArchiveControlBuilder(privateInfo, new GeneralName(new X509Name("CN=Test")))
.AddRecipientGenerator(new KeyTransRecipientInfoGenerator()
{
RecipientCert = cert,
SubjectKeyIdentifier = (DerOctetString)SubjectKeyIdentifier.CreateSha1KeyIdentifier(publicKeyInfo).ToAsn1Object()
}).Build(new CmsContentEncryptorBuilder(NistObjectIdentifiers.IdAes128Cbc)
.Build())
.AddRecipientGenerator(new CmsKeyTransRecipientInfoGenerator(cert, new Asn1KeyWrapper("RSA/None/OAEPwithSHA256andMGF1Padding", cert)))
.Build(new CmsContentEncryptorBuilder(NistObjectIdentifiers.IdAes128Cbc).Build())
);

var msg = certificateRequestMessageBuilder.Build();
Expand Down

0 comments on commit e0d1810

Please sign in to comment.