diff options
author | Brian Carlstrom <bdc@google.com> | 2012-03-22 00:29:55 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2012-03-22 14:28:24 -0700 |
commit | 5b7f91c1e6e208187cef57ab8a5de0a7f35e817f (patch) | |
tree | 02c2e8221643750dbad2462036e043a1585f36d1 /support/src | |
parent | 3e6dd45baa0d7f9b4fa06f4ade76e088b59cc7bf (diff) | |
download | libcore-5b7f91c1e6e208187cef57ab8a5de0a7f35e817f.zip libcore-5b7f91c1e6e208187cef57ab8a5de0a7f35e817f.tar.gz libcore-5b7f91c1e6e208187cef57ab8a5de0a7f35e817f.tar.bz2 |
Split OpenSSLRSAPrivateCrtKey from OpenSSLRSAPrivateKey
Change-Id: I6a58044162758b3b74db5d17e9044f97dbe53bae
Diffstat (limited to 'support/src')
-rw-r--r-- | support/src/test/java/tests/security/KeyFactoryTest.java | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/support/src/test/java/tests/security/KeyFactoryTest.java b/support/src/test/java/tests/security/KeyFactoryTest.java index e2f687d..1d55c52 100644 --- a/support/src/test/java/tests/security/KeyFactoryTest.java +++ b/support/src/test/java/tests/security/KeyFactoryTest.java @@ -46,50 +46,17 @@ public abstract class KeyFactoryTest<PublicKeySpec extends KeySpec, PrivateKeySp factory = getFactory(); } - private KeyFactory getFactory() { - try { - return KeyFactory.getInstance(algorithmName); - } catch (NoSuchAlgorithmException e) { - fail(e.getMessage()); - } - return null; + private KeyFactory getFactory() throws Exception { + return KeyFactory.getInstance(algorithmName); } - public void testKeyFactory() { - PrivateKeySpec privateKeySpec = null; - try { - privateKeySpec = factory.getKeySpec(DefaultKeys.getPrivateKey(algorithmName), - privateKeySpecClass); - } catch (InvalidKeySpecException e) { - fail(e.getMessage()); - } catch (NoSuchAlgorithmException e) { - fail(e.getMessage()); - } - - PrivateKey privateKey = null; - try { - privateKey = factory.generatePrivate(privateKeySpec); - } catch (InvalidKeySpecException e) { - fail(e.getMessage()); - } - - PublicKeySpec publicKeySpec = null; - try { - publicKeySpec = factory.getKeySpec(DefaultKeys.getPublicKey(algorithmName), - publicKeySpecClass); - } catch (InvalidKeySpecException e) { - fail(e.getMessage()); - } catch (NoSuchAlgorithmException e) { - fail(e.getMessage()); - } - - PublicKey publicKey = null; - try { - publicKey = factory.generatePublic(publicKeySpec); - } catch (InvalidKeySpecException e) { - fail(e.getMessage()); - } - + public void testKeyFactory() throws Exception { + PrivateKeySpec privateKeySpec = factory.getKeySpec(DefaultKeys.getPrivateKey(algorithmName), + privateKeySpecClass); + PrivateKey privateKey = factory.generatePrivate(privateKeySpec); + PublicKeySpec publicKeySpec = factory.getKeySpec(DefaultKeys.getPublicKey(algorithmName), + publicKeySpecClass); + PublicKey publicKey = factory.generatePublic(publicKeySpec); check(new KeyPair(publicKey, privateKey)); } |