Red Hat Application Migration Toolkit
package iaik.pkcs.pkcs12; import iaik.security.cipher.PBEKeyBMP; import java.security.InvalidKeyException; import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactorySpi; import javax.crypto.spec.PBEKeySpec; public final class KeyFactory extends SecretKeyFactorySpi { // $FF: synthetic field static Class a; static Class a(String var0) { try { return Class.forName(var0); } catch (ClassNotFoundException var2) { throw new NoClassDefFoundError(var2.getMessage()); } } protected SecretKey engineTranslateKey(SecretKey var1) throws InvalidKeyException { if(var1 == null) { throw new InvalidKeyException("Cannot translate a null key!"); } else { return new PBEKeyBMP((new String(var1.getEncoded())).toCharArray()); } } protected KeySpec engineGetKeySpec(SecretKey var1, Class var2) throws InvalidKeySpecException { if(var1 instanceof PBEKeyBMP) { if((a != null?a:(a = a("javax.crypto.spec.PBEKeySpec"))).isAssignableFrom(var2)) { return new PBEKeySpec(((PBEKeyBMP)var1).getKey()); } else { throw new InvalidKeySpecException("Can\'t convert key to KeySpec."); } } else { throw new InvalidKeySpecException("Only PBEKeys can be converted."); } } protected SecretKey engineGenerateSecret(KeySpec var1) throws InvalidKeySpecException { if(var1 instanceof PBEKeySpec) { return new PBEKeyBMP((PBEKeySpec)var1); } else { throw new InvalidKeySpecException("Only PBEKeySpec allowed."); } } }