diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-07-21 19:44:38 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-07-21 19:44:38 +0700 |
commit | 711fda7025306bacc23a24578a26f2530971e718 (patch) | |
tree | 0aae3596251154f856c73fa8effb951fb3180fb3 | |
parent | AES perf. opt. (diff) | |
download | BouncyCastle.NET-ed25519-711fda7025306bacc23a24578a26f2530971e718.tar.xz |
Followup OAEP changes
-rw-r--r-- | crypto/src/asn1/pkcs/RSAESOAEPparams.cs | 4 | ||||
-rw-r--r-- | crypto/src/security/WrapperUtilities.cs | 1 | ||||
-rw-r--r-- | crypto/test/src/cms/test/EnvelopedDataTest.cs | 62 |
3 files changed, 33 insertions, 34 deletions
diff --git a/crypto/src/asn1/pkcs/RSAESOAEPparams.cs b/crypto/src/asn1/pkcs/RSAESOAEPparams.cs index 6434f0935..2419e33c7 100644 --- a/crypto/src/asn1/pkcs/RSAESOAEPparams.cs +++ b/crypto/src/asn1/pkcs/RSAESOAEPparams.cs @@ -36,14 +36,14 @@ namespace Org.BouncyCastle.Asn1.Pkcs * The default version */ public RsaesOaepParameters() - : this(DefaultHashAlgorithm, DefaultMaskGenFunction, DefaultPSourceAlgorithm) + : this(DefaultHashAlgorithm, DefaultMaskGenFunction, DefaultPSourceAlgorithm) { } public RsaesOaepParameters( AlgorithmIdentifier hashAlgorithm, AlgorithmIdentifier maskGenAlgorithm) - : this(DefaultHashAlgorithm, DefaultMaskGenFunction, DefaultPSourceAlgorithm) + : this(hashAlgorithm, maskGenAlgorithm, DefaultPSourceAlgorithm) { } diff --git a/crypto/src/security/WrapperUtilities.cs b/crypto/src/security/WrapperUtilities.cs index e0c677e42..c57632081 100644 --- a/crypto/src/security/WrapperUtilities.cs +++ b/crypto/src/security/WrapperUtilities.cs @@ -6,7 +6,6 @@ using Org.BouncyCastle.Asn1.Kisa; using Org.BouncyCastle.Asn1.Nist; using Org.BouncyCastle.Asn1.Ntt; using Org.BouncyCastle.Asn1.Pkcs; -using Org.BouncyCastle.Asn1.X509; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Engines; using Org.BouncyCastle.Utilities; diff --git a/crypto/test/src/cms/test/EnvelopedDataTest.cs b/crypto/test/src/cms/test/EnvelopedDataTest.cs index 04e75f623..1017d35db 100644 --- a/crypto/test/src/cms/test/EnvelopedDataTest.cs +++ b/crypto/test/src/cms/test/EnvelopedDataTest.cs @@ -326,7 +326,7 @@ namespace Org.BouncyCastle.Cms.Tests } [Test] - public void TestKeyTransSmallAesUsingAoep() + public void TestKeyTransSmallAesUsingOaep() { byte[] data = new byte[] { 0, 1, 2, 3 }; @@ -356,7 +356,7 @@ namespace Org.BouncyCastle.Cms.Tests } [Test] - public void TestKeyTransSmallAesUsingAoepMixed() + public void TestKeyTransSmallAesUsingOaepMixed() { byte[] data = new byte[] { 0, 1, 2, 3 }; @@ -384,44 +384,44 @@ namespace Org.BouncyCastle.Cms.Tests } } - [Test] - public void TestKeyTransSmallAesUsingAoepMixedParams() - { - byte[] data = new byte[] { 0, 1, 2, 3 }; + [Test] + public void TestKeyTransSmallAesUsingOaepMixedParams() + { + byte[] data = new byte[]{ 0, 1, 2, 3 }; - CmsEnvelopedDataGenerator edGen = new CmsEnvelopedDataGenerator(); + CmsEnvelopedDataGenerator edGen = new CmsEnvelopedDataGenerator(); - edGen.AddRecipientInfoGenerator( - new KeyTransRecipientInfoGenerator( - ReciCert, - new Asn1KeyWrapper( - PkcsObjectIdentifiers.IdRsaesOaep, - new RsaesOaepParameters( - new AlgorithmIdentifier(NistObjectIdentifiers.IdSha256, DerNull.Instance), - new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, new AlgorithmIdentifier(NistObjectIdentifiers.IdSha224, DerNull.Instance))), - ReciCert))); + edGen.AddRecipientInfoGenerator( + new KeyTransRecipientInfoGenerator( + ReciCert, + new Asn1KeyWrapper( + PkcsObjectIdentifiers.IdRsaesOaep, + new RsaesOaepParameters( + new AlgorithmIdentifier(NistObjectIdentifiers.IdSha256, DerNull.Instance), + new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, + new AlgorithmIdentifier(NistObjectIdentifiers.IdSha224, DerNull.Instance))), + ReciCert))); - CmsEnvelopedData ed = edGen.Generate( - new CmsProcessableByteArray(data), - CmsEnvelopedDataGenerator.Aes128Cbc); + CmsEnvelopedData ed = edGen.Generate( + new CmsProcessableByteArray(data), + CmsEnvelopedGenerator.Aes128Cbc); - RecipientInformationStore recipients = ed.GetRecipientInfos(); + RecipientInformationStore recipients = ed.GetRecipientInfos(); - Assert.AreEqual(ed.EncryptionAlgOid, - CmsEnvelopedDataGenerator.Aes128Cbc); + Assert.AreEqual(ed.EncryptionAlgOid, CmsEnvelopedGenerator.Aes128Cbc); - ICollection c = recipients.GetRecipients(); + ICollection c = recipients.GetRecipients(); - Assert.AreEqual(1, c.Count); + Assert.AreEqual(1, c.Count); - foreach (RecipientInformation recipient in c) - { - byte[] recData = recipient.GetContent(ReciKP.Private); - Assert.IsTrue(Arrays.AreEqual(data, recData)); - } - } + foreach (RecipientInformation recipient in c) + { + byte[] recData = recipient.GetContent(ReciKP.Private); + Assert.IsTrue(Arrays.AreEqual(data, recData)); + } + } - [Test] + [Test] public void TestKeyTransSmallAesUsingPkcs1() { byte[] data = new byte[] { 0, 1, 2, 3 }; |