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

  1. package sun.security.x509;
  2.  
  3. import java.io.ByteArrayOutputStream;
  4. import java.io.IOException;
  5. import java.math.BigInteger;
  6. import java.security.ProviderException;
  7. import java.security.interfaces.DSAParams;
  8. import sun.security.util.BigInt;
  9. import sun.security.util.DerOutputStream;
  10. import sun.security.util.DerValue;
  11.  
  12. public final class AlgIdDSA extends AlgorithmId implements DSAParams {
  13.    // $FF: renamed from: p java.math.BigInteger
  14.    private BigInteger field_0;
  15.    // $FF: renamed from: q java.math.BigInteger
  16.    private BigInteger field_1;
  17.    // $FF: renamed from: g java.math.BigInteger
  18.    private BigInteger field_2;
  19.  
  20.    public BigInteger getP() {
  21.       return this.field_0;
  22.    }
  23.  
  24.    public BigInteger getQ() {
  25.       return this.field_1;
  26.    }
  27.  
  28.    public BigInteger getG() {
  29.       return this.field_2;
  30.    }
  31.  
  32.    public AlgIdDSA() {
  33.    }
  34.  
  35.    AlgIdDSA(DerValue var1) throws IOException {
  36.       super(var1.getOID());
  37.    }
  38.  
  39.    public AlgIdDSA(byte[] var1) throws IOException {
  40.       super((new DerValue(var1)).getOID());
  41.    }
  42.  
  43.    public AlgIdDSA(byte[] var1, byte[] var2, byte[] var3) throws IOException {
  44.       this(new BigInteger(1, var1), new BigInteger(1, var2), new BigInteger(1, var3));
  45.    }
  46.  
  47.    public AlgIdDSA(BigInteger var1, BigInteger var2, BigInteger var3) {
  48.       super(AlgorithmId.DSA_oid);
  49.  
  50.       try {
  51.          this.field_0 = var1;
  52.          this.field_1 = var2;
  53.          this.field_2 = var3;
  54.          this.initializeParams();
  55.       } catch (IOException var4) {
  56.          throw new ProviderException("Construct DSS/DSA Algorithm ID");
  57.       }
  58.    }
  59.  
  60.    public String getName() {
  61.       return "DSA";
  62.    }
  63.  
  64.    private void initializeParams() throws IOException {
  65.       DerOutputStream var1 = new DerOutputStream();
  66.       var1.putInteger(new BigInt(this.field_0.toByteArray()));
  67.       var1.putInteger(new BigInt(this.field_1.toByteArray()));
  68.       var1.putInteger(new BigInt(this.field_2.toByteArray()));
  69.       super.params = new DerValue((byte)48, ((ByteArrayOutputStream)var1).toByteArray());
  70.    }
  71.  
  72.    protected void decodeParams() throws IOException {
  73.       if (super.params != null && super.params.tag == 48) {
  74.          super.params.data.reset();
  75.          this.field_0 = super.params.data.getInteger().toBigInteger();
  76.          this.field_1 = super.params.data.getInteger().toBigInteger();
  77.          this.field_2 = super.params.data.getInteger().toBigInteger();
  78.          if (super.params.data.available() != 0) {
  79.             throw new IOException("AlgIdDSA params, extra=" + super.params.data.available());
  80.          }
  81.       } else {
  82.          throw new IOException("DSA alg parsing error");
  83.       }
  84.    }
  85.  
  86.    public String toString() {
  87.       return this.paramsToString();
  88.    }
  89.  
  90.    protected String paramsToString() {
  91.       return "\np: " + this.field_0.toString(16) + "\nq: " + this.field_1.toString(16) + "\ng: " + this.field_2.toString(16) + "\n    ";
  92.    }
  93. }
  94.