diff options
author | Elliott Hughes <enh@google.com> | 2010-05-13 12:36:25 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-05-13 12:49:12 -0700 |
commit | f33eae7e84eb6d3b0f4e86b59605bb3de73009f3 (patch) | |
tree | f6cb62c04ce2669d2fa4715fbab86d38c8fca06d /luni/src/test/java/tests/targets/security | |
parent | d21d78fd49a2d798218e8c8aefbddb26a0e71bbb (diff) | |
download | libcore-f33eae7e84eb6d3b0f4e86b59605bb3de73009f3.zip libcore-f33eae7e84eb6d3b0f4e86b59605bb3de73009f3.tar.gz libcore-f33eae7e84eb6d3b0f4e86b59605bb3de73009f3.tar.bz2 |
Remove all trailing whitespace from the dalvik team-maintained parts of libcore.
Gentlemen, you may now set your editors to "strip trailing whitespace"...
Change-Id: I85b2f6c80e5fbef1af6cab11789790b078c11b1b
Diffstat (limited to 'luni/src/test/java/tests/targets/security')
18 files changed, 92 insertions, 92 deletions
diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java b/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java index 530e5ec..108b433 100644 --- a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java +++ b/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTest.java @@ -63,7 +63,7 @@ public abstract class AlgorithmParameterGeneratorTest extends TestCase { generator.init(1024); AlgorithmParameters parameters = generator.generateParameters(); - + assertNotNull("generated parameters are null", parameters); helper.test(parameters); diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java b/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java index a0f4b72..702e191 100644 --- a/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java +++ b/luni/src/test/java/tests/targets/security/AlgorithmParameterGeneratorTestDSA.java @@ -27,5 +27,5 @@ public class AlgorithmParameterGeneratorTestDSA extends super("DSA", new AlgorithmParameterSignatureHelper<DSAParameterSpec>("DSA", DSAParameterSpec.class)); } - + } diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java index 9bdf6c6..d12086e 100644 --- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java +++ b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestAES.java @@ -27,7 +27,7 @@ public class AlgorithmParametersTestAES extends AlgorithmParametersTest { (byte) 0xFF, (byte) 0x64, (byte) 0x72, (byte) 0xF5, (byte) 0x04, (byte) 0x08, (byte) 0x68, (byte) 0xC8, (byte) 0xFF, (byte) 0x64, (byte) 0x72, (byte) 0xF5 }; - + public AlgorithmParametersTestAES() { super("AES", new AlgorithmParameterSymmetricHelper("AES", "CBC/PKCS5PADDING", 128), new IvParameterSpec(parameterData)); } diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java index 9aed7c1..c272cdd 100644 --- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java +++ b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDES.java @@ -25,7 +25,7 @@ public class AlgorithmParametersTestDES extends AlgorithmParametersTest { private static final byte[] parameterData = new byte[] { (byte) 0x04, (byte) 0x08, (byte) 0x68, (byte) 0xC8, (byte) 0xFF, (byte) 0x64, (byte) 0x72, (byte) 0xF5 }; - + public AlgorithmParametersTestDES() { super("DES", new AlgorithmParameterSymmetricHelper("DES", "CBC/PKCS5PADDING", 56), new IvParameterSpec(parameterData)); } diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java index 9163825..b02152d 100644 --- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java +++ b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDESede.java @@ -25,7 +25,7 @@ public class AlgorithmParametersTestDESede extends AlgorithmParametersTest { private static final byte[] parameterData = new byte[] { (byte) 0x04, (byte) 0x08, (byte) 0x68, (byte) 0xC8, (byte) 0xFF, (byte) 0x64, (byte) 0x72, (byte) 0xF5 }; - + public AlgorithmParametersTestDESede() { super("DESede", new AlgorithmParameterSymmetricHelper("DESede", "CBC/PKCS5PADDING", 112), new IvParameterSpec(parameterData)); } diff --git a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java index 8943c62..62454a6 100644 --- a/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java +++ b/luni/src/test/java/tests/targets/security/AlgorithmParametersTestDH.java @@ -87,5 +87,5 @@ public class AlgorithmParametersTestDH extends AlgorithmParametersTest { public void testAlgorithmParameters() { super.testAlgorithmParameters(); } - + } diff --git a/luni/src/test/java/tests/targets/security/AllTests.java b/luni/src/test/java/tests/targets/security/AllTests.java index 7d5802d..2a509a7 100644 --- a/luni/src/test/java/tests/targets/security/AllTests.java +++ b/luni/src/test/java/tests/targets/security/AllTests.java @@ -39,7 +39,7 @@ public class AllTests { suite.addTestSuite(KeyFactoryTestRSA.class); suite.addTestSuite(KeyFactoryTestDSA.class); suite.addTestSuite(KeyFactoryTestDH.class); - + suite.addTestSuite(SignatureTestMD2withRSA.class); suite.addTestSuite(SignatureTestMD5withRSA.class); suite.addTestSuite(SignatureTestNONEwithDSA.class); @@ -49,22 +49,22 @@ public class AllTests { suite.addTestSuite(SignatureTestSHA256withRSA.class); suite.addTestSuite(SignatureTestSHA384withRSA.class); suite.addTestSuite(SignatureTestSHA512withRSA.class); - + suite.addTestSuite(AlgorithmParameterGeneratorTestAES.class); suite.addTestSuite(AlgorithmParameterGeneratorTestDH.class); suite.addTestSuite(AlgorithmParameterGeneratorTestDSA.class); - + suite.addTestSuite(AlgorithmParametersTestDES.class); suite.addTestSuite(AlgorithmParametersTestDESede.class); suite.addTestSuite(AlgorithmParametersTestDSA.class); suite.addTestSuite(AlgorithmParametersTestOAEP.class); suite.addTestSuite(AlgorithmParametersTestAES.class); suite.addTestSuite(AlgorithmParametersTestDH.class); - + suite.addTestSuite(KeyStoreTestPKCS12.class); - + suite.addTestSuite(SecureRandomTestSHA1PRNG.class); - + suite.addTestSuite(DHTest.class); // $JUnit-END$ diff --git a/luni/src/test/java/tests/targets/security/CipherHelper.java b/luni/src/test/java/tests/targets/security/CipherHelper.java index 1ab5b34..a6ff89a 100644 --- a/luni/src/test/java/tests/targets/security/CipherHelper.java +++ b/luni/src/test/java/tests/targets/security/CipherHelper.java @@ -64,8 +64,8 @@ abstract class CipherHelper<T/*, U*/> extends TestHelper<T/*, Key*/> { this.mode1 = mode1; this.mode2 = mode2; } - - + + // @Override void test(Key encryptKey, Key decryptKey) { @@ -120,7 +120,7 @@ class CipherAsymmetricCryptHelper extends CipherHelper<KeyPair/*, U*/> { super(algorithmName, plainData, Cipher.ENCRYPT_MODE, Cipher.DECRYPT_MODE); } - + @Override void test(KeyPair keyPair) { test(keyPair.getPrivate(), keyPair.getPublic()); @@ -136,7 +136,7 @@ class CipherSymmetricCryptHelper extends CipherHelper<SecretKey/*, U*/> { super(algorithmName, plainData, Cipher.ENCRYPT_MODE, Cipher.DECRYPT_MODE); } - + @Override void test(SecretKey key) { test(key, key); @@ -151,7 +151,7 @@ class SignatureHelper extends TestHelper<KeyPair> { protected SignatureHelper(String algorithmName) { this.algorithmName = algorithmName; } - + @Override void test(KeyPair keyPair) { test(keyPair.getPrivate(), keyPair.getPublic()); @@ -252,26 +252,26 @@ class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> private static final String plainData = "some data to encrypt and decrypt"; private final String algorithmName; - + protected AlgorithmParameterAsymmetricHelper(String algorithmName) { this.algorithmName = algorithmName; } @Override void test(AlgorithmParameters parameters) { - + KeyPairGenerator generator = null; try { generator = KeyPairGenerator.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { Assert.fail(e.getMessage()); } - + generator.initialize(1024); - + KeyPair keyPair = generator.generateKeyPair(); - - + + Cipher cipher = null; try { cipher = Cipher.getInstance(algorithmName); @@ -280,7 +280,7 @@ class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> } catch (NoSuchPaddingException e) { Assert.fail(e.getMessage()); } - + try { cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic(), parameters); } catch (InvalidKeyException e) { @@ -288,7 +288,7 @@ class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> } catch (InvalidAlgorithmParameterException e) { Assert.fail(e.getMessage()); } - + byte[] bs = null; try { bs = cipher.doFinal(plainData.getBytes()); @@ -297,7 +297,7 @@ class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> } catch (BadPaddingException e) { Assert.fail(e.getMessage()); } - + try { cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate(), parameters); } catch (InvalidKeyException e) { @@ -305,7 +305,7 @@ class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> } catch (InvalidAlgorithmParameterException e) { Assert.fail(e.getMessage()); } - + byte[] decrypted = null; try { decrypted = cipher.doFinal(bs); @@ -314,7 +314,7 @@ class AlgorithmParameterAsymmetricHelper extends TestHelper<AlgorithmParameters> } catch (BadPaddingException e) { Assert.fail(e.getMessage()); } - + Assert.assertTrue(Arrays.equals(plainData.getBytes(), decrypted)); } } @@ -325,12 +325,12 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> private final String algorithmName; private final int keySize; private String blockmode; - + protected AlgorithmParameterSymmetricHelper(String algorithmName, int keySize) { this.algorithmName = algorithmName; this.keySize = keySize; } - + protected AlgorithmParameterSymmetricHelper(String algorithmName, String blockmode, int keySize) { this(algorithmName, keySize); this.blockmode = blockmode; @@ -338,19 +338,19 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> @Override void test(AlgorithmParameters parameters) { - + KeyGenerator generator = null; try { generator = KeyGenerator.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { Assert.fail(e.getMessage()); } - + generator.init(keySize); - + Key key = generator.generateKey(); - - + + Cipher cipher = null; try { String transformation = algorithmName; @@ -364,7 +364,7 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> } catch (NoSuchPaddingException e) { Assert.fail(e.getMessage()); } - + try { cipher.init(Cipher.ENCRYPT_MODE, key, parameters); } catch (InvalidKeyException e) { @@ -372,7 +372,7 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> } catch (InvalidAlgorithmParameterException e) { Assert.fail(e.getMessage()); } - + byte[] bs = null; try { bs = cipher.doFinal(plainData.getBytes()); @@ -381,7 +381,7 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> } catch (BadPaddingException e) { Assert.fail(e.getMessage()); } - + try { cipher.init(Cipher.DECRYPT_MODE, key, parameters); } catch (InvalidKeyException e) { @@ -389,7 +389,7 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> } catch (InvalidAlgorithmParameterException e) { Assert.fail(e.getMessage()); } - + byte[] decrypted = null; try { decrypted = cipher.doFinal(bs); @@ -398,7 +398,7 @@ class AlgorithmParameterSymmetricHelper extends TestHelper<AlgorithmParameters> } catch (BadPaddingException e) { Assert.fail(e.getMessage()); } - + Assert.assertTrue(Arrays.equals(plainData.getBytes(), decrypted)); } } @@ -424,28 +424,28 @@ class AlgorithmParameterSignatureHelper<T extends AlgorithmParameterSpec> extend } catch (NoSuchAlgorithmException e) { Assert.fail(e.getMessage()); } - - + + T parameterSpec = null; try { parameterSpec = parameters.getParameterSpec(parameterSpecClass); } catch (InvalidParameterSpecException e) { Assert.fail(e.getMessage()); } - + KeyPairGenerator generator = null; try { generator = KeyPairGenerator.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { Assert.fail(e.getMessage()); } - + try { generator.initialize(parameterSpec); } catch (InvalidAlgorithmParameterException e) { Assert.fail(e.getMessage()); } - + KeyPair keyPair = generator.genKeyPair(); try { @@ -505,11 +505,11 @@ class AlgorithmParameterKeyAgreementHelper extends TestHelper<AlgorithmParameter } catch (NoSuchAlgorithmException e) { Assert.fail(e.getMessage()); } - + generator.initialize(1024); - + KeyPair keyPair = generator.generateKeyPair(); - + KeyAgreement keyAgreement = null; try { keyAgreement = KeyAgreement.getInstance(algorithmName); diff --git a/luni/src/test/java/tests/targets/security/DHTest.java b/luni/src/test/java/tests/targets/security/DHTest.java index 3f5adc1..a045fab 100644 --- a/luni/src/test/java/tests/targets/security/DHTest.java +++ b/luni/src/test/java/tests/targets/security/DHTest.java @@ -48,13 +48,13 @@ public class DHTest extends TestCase { } catch (NoSuchAlgorithmException e) { fail(e.getMessage()); } - + AlgorithmParameterGenerator algorithmparametergenerator = AlgorithmParameterGenerator.getInstance("DH"); algorithmparametergenerator.init(1024, new SecureRandom()); AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters(); DHParameterSpec dhparameterspec = algorithmparameters.getParameterSpec(DHParameterSpec.class); - + //gen.initialize(1024); gen.initialize(dhparameterspec); KeyPair key = gen.generateKeyPair(); diff --git a/luni/src/test/java/tests/targets/security/DefaultKeys.java b/luni/src/test/java/tests/targets/security/DefaultKeys.java index a517d9c..c8ae8d5 100644 --- a/luni/src/test/java/tests/targets/security/DefaultKeys.java +++ b/luni/src/test/java/tests/targets/security/DefaultKeys.java @@ -26,7 +26,7 @@ import java.security.spec.X509EncodedKeySpec; import java.util.HashMap; public class DefaultKeys { - private static final byte[] RSA_private = new byte[] { + private static final byte[] RSA_private = new byte[] { (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x75, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x0D, (byte) 0x06, (byte) 0x09, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xF7, (byte) 0x0D, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x82, (byte) 0x02, (byte) 0x5F, (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x5B, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0x99, (byte) 0xA5, (byte) 0x96, (byte) 0x72, (byte) 0xAE, (byte) 0xBB, (byte) 0x59, (byte) 0x36, (byte) 0xA8, (byte) 0x12, (byte) 0x17, (byte) 0x05, (byte) 0x4C, (byte) 0x63, @@ -65,7 +65,7 @@ public class DefaultKeys { (byte) 0x1C, (byte) 0x7D, (byte) 0xCA, (byte) 0x93, (byte) 0x67, (byte) 0x8F, (byte) 0x28, (byte) 0xB7, (byte) 0x60, (byte) 0x8E, (byte) 0xF0, (byte) 0x5D, (byte) 0xCD, (byte) 0xFA, (byte) 0xDD, (byte) 0x6B, (byte) 0x72, (byte) 0xF7, (byte) 0x48, (byte) 0xD9, (byte) 0x3C, (byte) 0x40, (byte) 0x7C, (byte) 0xB0, (byte) 0xD7, (byte) 0x58, (byte) 0xC2, (byte) 0x53, (byte) 0xAD, (byte) 0x04, (byte) 0xF6, (byte) 0x0B, (byte) 0x35, (byte) 0x51, (byte) 0x45, (byte) 0xB9, (byte) 0x4F, (byte) 0x49 }; - private static final byte[] RSA_public = new byte[] { + private static final byte[] RSA_public = new byte[] { (byte) 0x30, (byte) 0x81, (byte) 0x9F, (byte) 0x30, (byte) 0x0D, (byte) 0x06, (byte) 0x09, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xF7, (byte) 0x0D, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x03, (byte) 0x81, (byte) 0x8D, (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0x89, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0x99, (byte) 0xA5, (byte) 0x96, (byte) 0x72, (byte) 0xAE, (byte) 0xBB, (byte) 0x59, (byte) 0x36, (byte) 0xA8, (byte) 0x12, (byte) 0x17, (byte) 0x05, (byte) 0x4C, (byte) 0x63, (byte) 0x9E, (byte) 0xB8, (byte) 0x85, (byte) 0xD4, (byte) 0x2D, (byte) 0x71, (byte) 0xD7, (byte) 0x29, @@ -76,7 +76,7 @@ public class DefaultKeys { (byte) 0x55, (byte) 0x48, (byte) 0x5C, (byte) 0x94, (byte) 0x02, (byte) 0xF7, (byte) 0x84, (byte) 0xE6, (byte) 0x9B, (byte) 0x57, (byte) 0xFF, (byte) 0x17, (byte) 0x2A, (byte) 0xA1, (byte) 0x74, (byte) 0x8D, (byte) 0x07, (byte) 0xD8, (byte) 0xCE, (byte) 0xF7, (byte) 0x0B, (byte) 0x59, (byte) 0xFB, (byte) 0x13, (byte) 0x6E, (byte) 0xF1, (byte) 0xC3, (byte) 0xAB, (byte) 0x3E, (byte) 0x72, (byte) 0x1B, (byte) 0x62, (byte) 0x09, (byte) 0xE8, (byte) 0xD8, (byte) 0x41, (byte) 0x69, (byte) 0xE1, (byte) 0x02, (byte) 0x03, (byte) 0x01, (byte) 0x00, (byte) 0x01 }; - private static final byte[] DSA_private = new byte[] { + private static final byte[] DSA_private = new byte[] { (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x4B, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x2C, (byte) 0x06, (byte) 0x07, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0xCE, (byte) 0x38, (byte) 0x04, (byte) 0x01, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x1F, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xFD, (byte) 0x7F, (byte) 0x53, (byte) 0x81, (byte) 0x1D, (byte) 0x75, (byte) 0x12, (byte) 0x29, (byte) 0x52, (byte) 0xDF, (byte) 0x4A, (byte) 0x9C, (byte) 0x2E, (byte) 0xEC, (byte) 0xE4, (byte) 0xE7, (byte) 0xF6, (byte) 0x11, (byte) 0xB7, (byte) 0x52, (byte) 0x3C, (byte) 0xEF, (byte) 0x44, @@ -97,7 +97,7 @@ public class DefaultKeys { (byte) 0xDF, (byte) 0xE1, (byte) 0x5A, (byte) 0xE5, (byte) 0x9F, (byte) 0x06, (byte) 0x92, (byte) 0x8B, (byte) 0x66, (byte) 0x5E, (byte) 0x80, (byte) 0x7B, (byte) 0x55, (byte) 0x25, (byte) 0x64, (byte) 0x01, (byte) 0x4C, (byte) 0x3B, (byte) 0xFE, (byte) 0xCF, (byte) 0x49, (byte) 0x2A, (byte) 0x04, (byte) 0x16, (byte) 0x02, (byte) 0x14, (byte) 0x0E, (byte) 0x90, (byte) 0xB7, (byte) 0x92, (byte) 0x01, (byte) 0x98, (byte) 0xCD, (byte) 0x85, (byte) 0x87, (byte) 0x77, (byte) 0x2F, (byte) 0xB4, (byte) 0x31, (byte) 0xFD, (byte) 0xDE, (byte) 0xFA, (byte) 0x08, (byte) 0x6D, (byte) 0x0C, (byte) 0xE3 }; - private static final byte[] DSA_public = new byte[] { + private static final byte[] DSA_public = new byte[] { (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0xB8, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x2C, (byte) 0x06, (byte) 0x07, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0xCE, (byte) 0x38, (byte) 0x04, (byte) 0x01, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x1F, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xFD, (byte) 0x7F, (byte) 0x53, (byte) 0x81, (byte) 0x1D, (byte) 0x75, (byte) 0x12, (byte) 0x29, (byte) 0x52, (byte) 0xDF, (byte) 0x4A, (byte) 0x9C, (byte) 0x2E, (byte) 0xEC, (byte) 0xE4, (byte) 0xE7, (byte) 0xF6, (byte) 0x11, (byte) 0xB7, (byte) 0x52, (byte) 0x3C, (byte) 0xEF, (byte) 0x44, (byte) 0x00, (byte) 0xC3, (byte) 0x1E, @@ -125,7 +125,7 @@ public class DefaultKeys { (byte) 0x6F, (byte) 0x0A, (byte) 0x5A, (byte) 0xF3, (byte) 0x9E, (byte) 0x52, (byte) 0xF2, (byte) 0xC2, (byte) 0xC8, (byte) 0x00, (byte) 0x52, (byte) 0xC7, (byte) 0x75, (byte) 0xA4, (byte) 0xFD, (byte) 0x71, (byte) 0x2D, (byte) 0x7B, (byte) 0x7A, (byte) 0x31, (byte) 0x27, (byte) 0x6E, (byte) 0xAC, (byte) 0xB6, (byte) 0x40, (byte) 0x14, (byte) 0x4E, (byte) 0xB4, (byte) 0xBB, (byte) 0xB1, (byte) 0x51, (byte) 0x63, (byte) 0x29, (byte) 0x81, (byte) 0x06, (byte) 0xF9 }; - private static final byte[] DH_private = new byte[] { + private static final byte[] DH_private = new byte[] { (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0xA8, (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x1B, (byte) 0x06, (byte) 0x09, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xF7, (byte) 0x0D, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x0C, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xFD, (byte) 0x7F, (byte) 0x53, (byte) 0x81, (byte) 0x1D, (byte) 0x75, (byte) 0x12, (byte) 0x29, (byte) 0x52, (byte) 0xDF, (byte) 0x4A, (byte) 0x9C, (byte) 0x2E, (byte) 0xEC, (byte) 0xE4, (byte) 0xE7, (byte) 0xF6, (byte) 0x11, (byte) 0xB7, (byte) 0x52, (byte) 0x3C, @@ -152,7 +152,7 @@ public class DefaultKeys { (byte) 0x71, (byte) 0x38, (byte) 0x37, (byte) 0x9A, (byte) 0x19, (byte) 0xA3, (byte) 0xAF, (byte) 0xC8, (byte) 0xD5, (byte) 0x22, (byte) 0xDD, (byte) 0x00, (byte) 0x81, (byte) 0x19, (byte) 0xB6, (byte) 0x3C, (byte) 0x5F, (byte) 0xD9, (byte) 0xDF, (byte) 0xFD, (byte) 0x58, (byte) 0xB1, (byte) 0xE6, (byte) 0xD1, (byte) 0xD2, (byte) 0x58, (byte) 0xEF, (byte) 0x44, (byte) 0x6E, (byte) 0x66, (byte) 0x92, (byte) 0x1E, (byte) 0x30, (byte) 0x0B, (byte) 0x90, (byte) 0x8E, (byte) 0x29 }; - private static final byte[] DH_public = new byte[] { + private static final byte[] DH_public = new byte[] { (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0xA7, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x1B, (byte) 0x06, (byte) 0x09, (byte) 0x2A, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xF7, (byte) 0x0D, (byte) 0x01, (byte) 0x03, (byte) 0x01, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x0C, (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xFD, (byte) 0x7F, (byte) 0x53, (byte) 0x81, (byte) 0x1D, (byte) 0x75, (byte) 0x12, (byte) 0x29, (byte) 0x52, (byte) 0xDF, (byte) 0x4A, (byte) 0x9C, (byte) 0x2E, (byte) 0xEC, (byte) 0xE4, (byte) 0xE7, (byte) 0xF6, (byte) 0x11, (byte) 0xB7, (byte) 0x52, (byte) 0x3C, (byte) 0xEF, (byte) 0x44, (byte) 0x00, @@ -191,13 +191,13 @@ public class DefaultKeys { keys.put("RSA_public", new X509EncodedKeySpec(RSA_public)); keys.put("RSA_private", new PKCS8EncodedKeySpec(RSA_private)); } - + public static PrivateKey getPrivateKey(String algorithmName) throws NoSuchAlgorithmException, InvalidKeySpecException { KeyFactory factory = KeyFactory.getInstance(algorithmName); return factory.generatePrivate(keys.get(algorithmName + "_private")); } - + public static PublicKey getPublicKey(String algorithmName) throws NoSuchAlgorithmException, InvalidKeySpecException { KeyFactory factory = KeyFactory.getInstance(algorithmName); diff --git a/luni/src/test/java/tests/targets/security/KeyFactoryTest.java b/luni/src/test/java/tests/targets/security/KeyFactoryTest.java index e66e293..26cd8a3 100644 --- a/luni/src/test/java/tests/targets/security/KeyFactoryTest.java +++ b/luni/src/test/java/tests/targets/security/KeyFactoryTest.java @@ -119,9 +119,9 @@ public abstract class KeyFactoryTest<PublicKeySpec extends KeySpec, PrivateKeySp } catch (InvalidKeySpecException e) { fail(e.getMessage()); } - + KeyPair keyPair = new KeyPair(publicKey, privateKey); - + helper.test(keyPair); } } diff --git a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java b/luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java index 9e7cd0c..e7a8b35 100644 --- a/luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java +++ b/luni/src/test/java/tests/targets/security/KeyPairGeneratorTest.java @@ -31,7 +31,7 @@ public abstract class KeyPairGeneratorTest extends TestCase { private final String algorithmName; private final TestHelper<KeyPair> helper; - + private KeyPairGenerator generator; protected KeyPairGeneratorTest(String algorithmName, TestHelper<KeyPair> helper) { @@ -46,7 +46,7 @@ public abstract class KeyPairGeneratorTest extends TestCase { super.setUp(); generator = getKeyPairGenerator(); } - + private KeyPairGenerator getKeyPairGenerator() { try { return KeyPairGenerator.getInstance(algorithmName); diff --git a/luni/src/test/java/tests/targets/security/KeyStoreTest.java b/luni/src/test/java/tests/targets/security/KeyStoreTest.java index 2db3ad6..6a86966 100644 --- a/luni/src/test/java/tests/targets/security/KeyStoreTest.java +++ b/luni/src/test/java/tests/targets/security/KeyStoreTest.java @@ -96,7 +96,7 @@ public class KeyStoreTest extends TestCase { fail(e.getMessage()); } } - + @TestTargets({ @TestTargetNew( level=TestLevel.ADDITIONAL, @@ -118,7 +118,7 @@ public class KeyStoreTest extends TestCase { method="method", args={} ) - }) + }) public void testKeyStoreCreate() { KeyStore keyStore = null; try { diff --git a/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java b/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java index fe24ba7..0af202a 100644 --- a/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java +++ b/luni/src/test/java/tests/targets/security/KeyStoreTestPKCS12.java @@ -23,7 +23,7 @@ public class KeyStoreTestPKCS12 extends KeyStoreTest { public KeyStoreTestPKCS12() { super("PKCS12", keyStoreData, keyStorePassword); } - + public static final String keyStorePassword = "the keystore password"; public static final byte[] keyStoreData = new byte[] { diff --git a/luni/src/test/java/tests/targets/security/MessageDigestTest.java b/luni/src/test/java/tests/targets/security/MessageDigestTest.java index 05f9fc7..bbb6c1b 100644 --- a/luni/src/test/java/tests/targets/security/MessageDigestTest.java +++ b/luni/src/test/java/tests/targets/security/MessageDigestTest.java @@ -28,7 +28,7 @@ import java.security.NoSuchAlgorithmException; public abstract class MessageDigestTest extends TestCase { private String digestAlgorithmName; - + protected MessageDigestTest(String digestAlgorithmName) { super(); this.digestAlgorithmName = digestAlgorithmName; @@ -37,21 +37,21 @@ public abstract class MessageDigestTest extends TestCase { private MessageDigest digest; private InputStream sourceData; private byte[] checkDigest; - + @Override protected void setUp() throws Exception { super.setUp(); - + this.source3 = getLongMessage(1000000); this.digest = getMessageDigest(); this.sourceData = getSourceData(); this.checkDigest = getCheckDigest(); } - + @Override public void tearDown() throws Exception { super.tearDown(); - + // This is critical. The MessageDigest tests consume a lot of memory due // to the 1 MB buffers being allocated. We need to make sure all data is // freed after each test. Otherwise the Android runtime simply dies at @@ -59,18 +59,18 @@ public abstract class MessageDigestTest extends TestCase { source1 = null; source2 = null; source3 = null; - + expected1 = null; expected2 = null; expected3 = null; - + digest = null; sourceData = null; checkDigest = null; - + System.gc(); } - + MessageDigest getMessageDigest() { try { @@ -80,16 +80,16 @@ public abstract class MessageDigestTest extends TestCase { return null; } } - + InputStream getSourceData() { InputStream sourceStream = getClass().getResourceAsStream( digestAlgorithmName + ".data"); - assertNotNull("digest source data not found: " + digestAlgorithmName, + assertNotNull("digest source data not found: " + digestAlgorithmName, sourceStream); return sourceStream; } - + byte[] getCheckDigest() { InputStream checkDigestStream = getClass().getResourceAsStream( @@ -107,7 +107,7 @@ public abstract class MessageDigestTest extends TestCase { } return checkDigest; } - + @TestTargets({ @TestTargetNew( level = TestLevel.ADDITIONAL, @@ -137,21 +137,21 @@ public abstract class MessageDigestTest extends TestCase { } catch (IOException e) { fail("failed to read digest data"); } - + byte[] computedDigest = digest.digest(); - + assertNotNull("computed digest is is null", computedDigest); assertEquals("digest length mismatch", checkDigest.length, computedDigest.length); - + for (int i = 0; i < checkDigest.length; i++) { assertEquals("byte " + i + " of computed and check digest differ", checkDigest[i], computedDigest[i]); } - + } - + @TestTargets({ @TestTargetNew( level = TestLevel.ADDITIONAL, @@ -180,9 +180,9 @@ public abstract class MessageDigestTest extends TestCase { } catch (IOException e) { fail("failed to read digest data"); } - + byte[] computedDigest = digest.digest(); - + assertNotNull("computed digest is is null", computedDigest); assertEquals("digest length mismatch", checkDigest.length, computedDigest.length); @@ -191,7 +191,7 @@ public abstract class MessageDigestTest extends TestCase { assertEquals("byte " + i + " of computed and check digest differ", checkDigest[i], computedDigest[i]); } - + } @@ -242,7 +242,7 @@ public abstract class MessageDigestTest extends TestCase { res = Integer.toHexString(computedDigest[i] & 0xFF); sb.append((res.length() == 1 ? "0" : "") + res); } - assertEquals("computed and check digest differ", expected1, + assertEquals("computed and check digest differ", expected1, sb.toString()); } @@ -314,7 +314,7 @@ public abstract class MessageDigestTest extends TestCase { res = Integer.toHexString(computedDigest[i] & 0xFF); sb.append((res.length() == 1 ? "0" : "") + res); } - assertEquals("computed and check digest differ", expected3, + assertEquals("computed and check digest differ", expected3, sb.toString()); } } diff --git a/luni/src/test/java/tests/targets/security/SecureRandomTest.java b/luni/src/test/java/tests/targets/security/SecureRandomTest.java index 981c979..3203902 100644 --- a/luni/src/test/java/tests/targets/security/SecureRandomTest.java +++ b/luni/src/test/java/tests/targets/security/SecureRandomTest.java @@ -28,7 +28,7 @@ public abstract class SecureRandomTest extends TestCase { private final String algorithmName; - + private int counter=0; protected SecureRandomTest(String name) { diff --git a/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java b/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java index d242ced..2ac8131 100644 --- a/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java +++ b/luni/src/test/java/tests/targets/security/cert/CertPathBuilderTest.java @@ -37,7 +37,7 @@ public abstract class CertPathBuilderTest extends TestCase { @Override protected void setUp() throws Exception { super.setUp(); - + params = getCertPathParameters(); } @@ -76,7 +76,7 @@ public abstract class CertPathBuilderTest extends TestCase { CertPath path = builderResult.getCertPath(); assertNotNull("built path is null", path); - + validateCertPath(path); } } diff --git a/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java b/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java index 8c9c5d6..df2cc6b 100644 --- a/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java +++ b/luni/src/test/java/tests/targets/security/cert/CertificateFactoryTestX509.java @@ -24,7 +24,7 @@ public class CertificateFactoryTestX509 extends CertificateFactoryTest { super("X509", encodedCertificate.getBytes()); } - public static final String encodedCertificate = + public static final String encodedCertificate = "-----BEGIN CERTIFICATE-----\n" + "MIID0jCCAzugAwIBAgIBAjANBgkqhkiG9w0BAQQFADCBmjELMAkGA1UEBhMCVUsx\n" + "EjAQBgNVBAgTCUhhbXBzaGlyZTETMBEGA1UEBxMKV2luY2hlc3RlcjETMBEGA1UE\n" |