@Test(expected = InvalidKeySpecException.class) public void shouldComplainAboutNotGivenASecretKey() throws GeneralSecurityException { rawFactory.engineGetKeySpec(keySpec, RSAPrivateKeySpec.class); }
@Override protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (SecretKeySpec.class.isAssignableFrom(keySpec) && key instanceof SecretKeySpec) { return (SecretKeySpec) key; } throw log.keyMustImplementSecretKeySpecAndKeySpecMustBeSecretKeySpec( key.getClass().getName() + ", " + keySpec.getName()); }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (SecretKeySpec.class.isAssignableFrom(keySpec) && key instanceof SecretKeySpec) { return (SecretKeySpec) key; } throw log.keyMustImplementSecretKeySpecAndKeySpecMustBeSecretKeySpec( key.getClass().getName() + ", " + keySpec.getName()); } }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (SecretKeySpec.class.isAssignableFrom(keySpec) && key instanceof SecretKeySpec) { return (SecretKeySpec) key; } throw log.keyMustImplementSecretKeySpecAndKeySpecMustBeSecretKeySpec( key.getClass().getName() + ", " + keySpec.getName()); }  }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (SecretKeySpec.class.isAssignableFrom(keySpec) && key instanceof SecretKeySpec) { return (SecretKeySpec) key; } throw log.keyMustImplementSecretKeySpecAndKeySpecMustBeSecretKeySpec( key.getClass().getName() + ", " + keySpec.getName()); }   }
RawSecretKeyFactory extends SecretKeyFactorySpi { @Override protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec) throws InvalidKeySpecException { if (SecretKeySpec.class.isAssignableFrom(keySpec) && key instanceof SecretKeySpec) { return (SecretKeySpec) key; } throw log.keyMustImplementSecretKeySpecAndKeySpecMustBeSecretKeySpec( key.getClass().getName() + ", " + keySpec.getName()); }    }