home *** CD-ROM | disk | FTP | other *** search
- package java.security;
-
- import java.security.spec.InvalidKeySpecException;
- import java.security.spec.KeySpec;
-
- public class KeyFactory {
- private String algorithm;
- private Provider provider;
- private KeyFactorySpi keyFacSpi;
-
- protected KeyFactory(KeyFactorySpi var1, Provider var2, String var3) {
- this.keyFacSpi = var1;
- this.provider = var2;
- this.algorithm = var3;
- }
-
- public static KeyFactory getInstance(String var0) throws NoSuchAlgorithmException {
- try {
- Object[] var1 = Security.getImpl(var0, "KeyFactory", (String)null);
- return new KeyFactory((KeyFactorySpi)var1[0], (Provider)var1[1], var0);
- } catch (NoSuchProviderException var2) {
- throw new NoSuchAlgorithmException(var0 + " not found");
- }
- }
-
- public static KeyFactory getInstance(String var0, String var1) throws NoSuchAlgorithmException, NoSuchProviderException {
- if (var1 != null && var1.length() != 0) {
- Object[] var2 = Security.getImpl(var0, "KeyFactory", var1);
- return new KeyFactory((KeyFactorySpi)var2[0], (Provider)var2[1], var0);
- } else {
- throw new IllegalArgumentException("missing provider");
- }
- }
-
- public final Provider getProvider() {
- return this.provider;
- }
-
- public final String getAlgorithm() {
- return this.algorithm;
- }
-
- public final PublicKey generatePublic(KeySpec var1) throws InvalidKeySpecException {
- return this.keyFacSpi.engineGeneratePublic(var1);
- }
-
- public final PrivateKey generatePrivate(KeySpec var1) throws InvalidKeySpecException {
- return this.keyFacSpi.engineGeneratePrivate(var1);
- }
-
- public final KeySpec getKeySpec(Key var1, Class var2) throws InvalidKeySpecException {
- return this.keyFacSpi.engineGetKeySpec(var1, var2);
- }
-
- public final Key translateKey(Key var1) throws InvalidKeyException {
- return this.keyFacSpi.engineTranslateKey(var1);
- }
- }
-