home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / java / security / KeyFactory.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.1 KB  |  59 lines

  1. package java.security;
  2.  
  3. import java.security.spec.InvalidKeySpecException;
  4. import java.security.spec.KeySpec;
  5.  
  6. public class KeyFactory {
  7.    private String algorithm;
  8.    private Provider provider;
  9.    private KeyFactorySpi keyFacSpi;
  10.  
  11.    protected KeyFactory(KeyFactorySpi var1, Provider var2, String var3) {
  12.       this.keyFacSpi = var1;
  13.       this.provider = var2;
  14.       this.algorithm = var3;
  15.    }
  16.  
  17.    public static KeyFactory getInstance(String var0) throws NoSuchAlgorithmException {
  18.       try {
  19.          Object[] var1 = Security.getImpl(var0, "KeyFactory", (String)null);
  20.          return new KeyFactory((KeyFactorySpi)var1[0], (Provider)var1[1], var0);
  21.       } catch (NoSuchProviderException var2) {
  22.          throw new NoSuchAlgorithmException(var0 + " not found");
  23.       }
  24.    }
  25.  
  26.    public static KeyFactory getInstance(String var0, String var1) throws NoSuchAlgorithmException, NoSuchProviderException {
  27.       if (var1 != null && var1.length() != 0) {
  28.          Object[] var2 = Security.getImpl(var0, "KeyFactory", var1);
  29.          return new KeyFactory((KeyFactorySpi)var2[0], (Provider)var2[1], var0);
  30.       } else {
  31.          throw new IllegalArgumentException("missing provider");
  32.       }
  33.    }
  34.  
  35.    public final Provider getProvider() {
  36.       return this.provider;
  37.    }
  38.  
  39.    public final String getAlgorithm() {
  40.       return this.algorithm;
  41.    }
  42.  
  43.    public final PublicKey generatePublic(KeySpec var1) throws InvalidKeySpecException {
  44.       return this.keyFacSpi.engineGeneratePublic(var1);
  45.    }
  46.  
  47.    public final PrivateKey generatePrivate(KeySpec var1) throws InvalidKeySpecException {
  48.       return this.keyFacSpi.engineGeneratePrivate(var1);
  49.    }
  50.  
  51.    public final KeySpec getKeySpec(Key var1, Class var2) throws InvalidKeySpecException {
  52.       return this.keyFacSpi.engineGetKeySpec(var1, var2);
  53.    }
  54.  
  55.    public final Key translateKey(Key var1) throws InvalidKeyException {
  56.       return this.keyFacSpi.engineTranslateKey(var1);
  57.    }
  58. }
  59.