home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 April / DPPCPRO0499.ISO / April / Notes / 50b2wic.exe / DATA1.CAB / NotesProgramFilesJavaSupport / rt.jar / sun / security / provider / DSAPublicKey.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-04-23  |  2.3 KB  |  65 lines

  1. package sun.security.provider;
  2.  
  3. import java.io.IOException;
  4. import java.io.Serializable;
  5. import java.math.BigInteger;
  6. import java.security.InvalidKeyException;
  7. import java.security.interfaces.DSAParams;
  8. import sun.security.util.DerInputStream;
  9. import sun.security.util.DerValue;
  10. import sun.security.x509.AlgIdDSA;
  11. import sun.security.x509.X509Key;
  12.  
  13. public final class DSAPublicKey extends X509Key implements java.security.interfaces.DSAPublicKey, Serializable {
  14.    private static boolean debug;
  15.    // $FF: renamed from: y java.math.BigInteger
  16.    private BigInteger field_0;
  17.  
  18.    public DSAPublicKey() {
  19.    }
  20.  
  21.    public DSAPublicKey(byte[] var1) throws InvalidKeyException {
  22.       ((X509Key)this).decode(var1);
  23.    }
  24.  
  25.    public DSAPublicKey(BigInteger var1, BigInteger var2, BigInteger var3, BigInteger var4) throws InvalidKeyException {
  26.       this.field_0 = var1;
  27.       super.algid = new AlgIdDSA(var2, var3, var4);
  28.  
  29.       try {
  30.          super.key = (new DerValue((byte)2, var1.toByteArray())).toByteArray();
  31.       } catch (IOException var6) {
  32.          throw new InvalidKeyException("could not DER encode y: " + ((Throwable)var6).getMessage());
  33.       }
  34.    }
  35.  
  36.    public BigInteger getY() {
  37.       return this.field_0;
  38.    }
  39.  
  40.    public DSAParams getParams() {
  41.       return (DSAParams)super.algid;
  42.    }
  43.  
  44.    protected void parseKeyBits() throws InvalidKeyException {
  45.       try {
  46.          DerInputStream var1 = new DerInputStream(super.key);
  47.          this.field_0 = var1.getInteger().toBigInteger();
  48.       } catch (IOException var2) {
  49.          debug(var2);
  50.          throw new InvalidKeyException("Invalid key: y value\n" + ((Throwable)var2).getMessage());
  51.       }
  52.    }
  53.  
  54.    public String toString() {
  55.       return "Sun DSA Public Key \nparameters:" + super.algid + "\ny: " + this.field_0.toString(16) + "\n";
  56.    }
  57.  
  58.    private static void debug(Throwable var0) {
  59.       if (debug) {
  60.          var0.printStackTrace();
  61.       }
  62.  
  63.    }
  64. }
  65.