@Test(expected = InvalidKeySpecException.class) public void shouldComplainAboutNotGivenASecretKeySpec() throws InvalidKeySpecException { rawFactory.engineGenerateSecret(new RSAPrivateKeySpec(BigInteger.ONE, BigInteger.ONE)); }
@Override protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); } }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); }  }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); }   }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected SecretKey engineGenerateSecret(KeySpec keySpec) throws InvalidKeySpecException { if (keySpec instanceof SecretKeySpec) { return (SecretKeySpec) keySpec; } throw log.keySpecMustBeSecretKeySpec(keySpec.getClass().getName()); }    }