Skip to content

Commit 5e84519

Browse files
committed
minor clean up.
added backport of BaseBlockCipher for 1.5 migrated PBETest from 1.4 to 1.5. migrated PfxPduTest to 1.5.
1 parent 2815611 commit 5e84519

File tree

6 files changed

+1648
-5
lines changed

6 files changed

+1648
-5
lines changed

ant/jdk14.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
<exclude name="**/MailGeneralTest.java"/>
154154
<exclude name="**/SignedMailValidatorTest.java"/>
155155
<exclude name="**/DummyCertPathReviewer.java"/>
156+
<exclude name="**/NewSMIMEAuthEnvelopedTest.java"/>
156157
</fileset>
157158
<fileset dir="prov/src/test/java">
158159
<exclude name="**/AEADTest.java"/>

ant/jdk15+.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373

7474
</copy>
7575
<copy todir="${src.dir}" overwrite="true">
76+
<fileset dir="prov/src/main/jdk1.5" includes="**/*.java" />
77+
<fileset dir="prov/src/test/jdk1.5" includes="**/*.java" />
7678
<fileset dir="pkix/src/main/jdk1.5" includes="**/*.java" />
7779
<fileset dir="tls/src/main/jdk1.5" includes="**/*.java" />
7880
<fileset dir="tls/src/test/jdk1.5" includes="**/*.java" />

pkix/src/test/java/org/bouncycastle/pkcs/test/PfxPduTest.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
import org.bouncycastle.pkcs.PKCSException;
7070
import org.bouncycastle.pkcs.bc.BcPKCS12MacCalculatorBuilder;
7171
import org.bouncycastle.pkcs.bc.BcPKCS12MacCalculatorBuilderProvider;
72-
import org.bouncycastle.pkcs.bc.BcPKCS12PBMac1CalculatorBuilderProvider;
7372
import org.bouncycastle.pkcs.bc.BcPKCS12PBEInputDecryptorProviderBuilder;
7473
import org.bouncycastle.pkcs.bc.BcPKCS12PBEOutputEncryptorBuilder;
74+
import org.bouncycastle.pkcs.bc.BcPKCS12PBMac1CalculatorBuilderProvider;
7575
import org.bouncycastle.pkcs.jcajce.JcaPKCS12SafeBagBuilder;
7676
import org.bouncycastle.pkcs.jcajce.JcaPKCS8EncryptedPrivateKeyInfoBuilder;
7777
import org.bouncycastle.pkcs.jcajce.JcePKCS12MacCalculatorBuilder;
@@ -80,6 +80,7 @@
8080
import org.bouncycastle.pkcs.jcajce.JcePKCSPBEOutputEncryptorBuilder;
8181
import org.bouncycastle.util.Arrays;
8282
import org.bouncycastle.util.encoders.Base64;
83+
import org.junit.function.ThrowingRunnable;
8384

8485
import static org.junit.Assert.assertThrows;
8586

@@ -1138,7 +1139,7 @@ public void testPfxPduMac()
11381139
public void testPfxPduPBMac1PBKdf2()
11391140
throws Exception
11401141
{
1141-
char[] password = "1234".toCharArray();
1142+
final char[] password = "1234".toCharArray();
11421143
// valid test vectors
11431144
for (byte[] test_vector : new byte[][]{pkcs12WithPBMac1PBKdf2_a1, pkcs12WithPBMac1PBKdf2_a2, pkcs12WithPBMac1PBKdf2_a3})
11441145
{
@@ -1160,9 +1161,17 @@ public void testPfxPduPBMac1PBKdf2()
11601161
}
11611162

11621163
// invalid test vector that throws exception
1163-
PKCS12PfxPdu pfx = new PKCS12PfxPdu(pkcs12WithPBMac1PBKdf2_a6);
1164+
final PKCS12PfxPdu pfx = new PKCS12PfxPdu(pkcs12WithPBMac1PBKdf2_a6);
11641165
assertTrue(pfx.hasMac());
1165-
PKCSException thrown = assertThrows(PKCSException.class, () -> pfx.isMacValid(new BcPKCS12PBMac1CalculatorBuilderProvider(), password));
1166+
PKCSException thrown = assertThrows(PKCSException.class, new ThrowingRunnable()
1167+
{
1168+
@Override
1169+
public void run()
1170+
throws Throwable
1171+
{
1172+
pfx.isMacValid(new BcPKCS12PBMac1CalculatorBuilderProvider(), password);
1173+
}
1174+
});
11661175
assertTrue(thrown.getMessage().contains("Key length must be present when using PBMAC1."));
11671176
}
11681177

0 commit comments

Comments
 (0)