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 / AlgorithmParameters.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  2.5 KB  |  100 lines

  1. package java.security;
  2.  
  3. import java.io.IOException;
  4. import java.security.spec.AlgorithmParameterSpec;
  5. import java.security.spec.InvalidParameterSpecException;
  6.  
  7. public class AlgorithmParameters {
  8.    private Provider provider;
  9.    private AlgorithmParametersSpi paramSpi;
  10.    private String algorithm;
  11.    private boolean initialized = false;
  12.  
  13.    protected AlgorithmParameters(AlgorithmParametersSpi var1, Provider var2, String var3) {
  14.       this.paramSpi = var1;
  15.       this.provider = var2;
  16.       this.algorithm = var3;
  17.    }
  18.  
  19.    public final String getAlgorithm() {
  20.       return this.algorithm;
  21.    }
  22.  
  23.    public static AlgorithmParameters getInstance(String var0) throws NoSuchAlgorithmException {
  24.       try {
  25.          Object[] var1 = Security.getImpl(var0, "AlgorithmParameters", (String)null);
  26.          return new AlgorithmParameters((AlgorithmParametersSpi)var1[0], (Provider)var1[1], var0);
  27.       } catch (NoSuchProviderException var2) {
  28.          throw new NoSuchAlgorithmException(var0 + " not found");
  29.       }
  30.    }
  31.  
  32.    public static AlgorithmParameters getInstance(String var0, String var1) throws NoSuchAlgorithmException, NoSuchProviderException {
  33.       if (var1 != null && var1.length() != 0) {
  34.          Object[] var2 = Security.getImpl(var0, "AlgorithmParameters", var1);
  35.          return new AlgorithmParameters((AlgorithmParametersSpi)var2[0], (Provider)var2[1], var0);
  36.       } else {
  37.          throw new IllegalArgumentException("missing provider");
  38.       }
  39.    }
  40.  
  41.    public final Provider getProvider() {
  42.       return this.provider;
  43.    }
  44.  
  45.    public final void init(AlgorithmParameterSpec var1) throws InvalidParameterSpecException {
  46.       if (this.initialized) {
  47.          throw new InvalidParameterSpecException("already initialized");
  48.       } else {
  49.          this.paramSpi.engineInit(var1);
  50.          this.initialized = true;
  51.       }
  52.    }
  53.  
  54.    public final void init(byte[] var1) throws IOException {
  55.       if (this.initialized) {
  56.          throw new IOException("already initialized");
  57.       } else {
  58.          this.paramSpi.engineInit(var1);
  59.          this.initialized = true;
  60.       }
  61.    }
  62.  
  63.    public final void init(byte[] var1, String var2) throws IOException {
  64.       if (this.initialized) {
  65.          throw new IOException("already initialized");
  66.       } else {
  67.          this.paramSpi.engineInit(var1, var2);
  68.          this.initialized = true;
  69.       }
  70.    }
  71.  
  72.    public final AlgorithmParameterSpec getParameterSpec(Class var1) throws InvalidParameterSpecException {
  73.       if (!this.initialized) {
  74.          throw new InvalidParameterSpecException("not initialized");
  75.       } else {
  76.          return this.paramSpi.engineGetParameterSpec(var1);
  77.       }
  78.    }
  79.  
  80.    public final byte[] getEncoded() throws IOException {
  81.       if (!this.initialized) {
  82.          throw new IOException("not initialized");
  83.       } else {
  84.          return this.paramSpi.engineGetEncoded();
  85.       }
  86.    }
  87.  
  88.    public final byte[] getEncoded(String var1) throws IOException {
  89.       if (!this.initialized) {
  90.          throw new IOException("not initialized");
  91.       } else {
  92.          return this.paramSpi.engineGetEncoded(var1);
  93.       }
  94.    }
  95.  
  96.    public final String toString() {
  97.       return !this.initialized ? null : this.paramSpi.engineToString();
  98.    }
  99. }
  100.