home *** CD-ROM | disk | FTP | other *** search
- package sun.security.provider;
-
- import java.io.IOException;
- import java.io.Serializable;
- import java.math.BigInteger;
- import java.security.InvalidKeyException;
- import java.security.ProviderException;
- import java.security.interfaces.DSAParams;
- import sun.security.pkcs.PKCS8Key;
- import sun.security.util.DerInputStream;
- import sun.security.util.DerValue;
- import sun.security.x509.AlgIdDSA;
-
- public final class DSAPrivateKey extends PKCS8Key implements java.security.interfaces.DSAPrivateKey, Serializable {
- // $FF: renamed from: x java.math.BigInteger
- private BigInteger field_0;
-
- public DSAPrivateKey() {
- }
-
- public DSAPrivateKey(byte[] var1) throws InvalidKeyException {
- ((PKCS8Key)this).decode(var1);
- }
-
- public DSAPrivateKey(BigInteger var1, BigInteger var2, BigInteger var3, BigInteger var4) throws InvalidKeyException {
- super.algid = new AlgIdDSA(var2, var3, var4);
-
- try {
- super.key = (new DerValue((byte)2, var1.toByteArray())).toByteArray();
- ((PKCS8Key)this).encode();
- } catch (IOException var6) {
- throw new InvalidKeyException("counld not DER encode y: " + ((Throwable)var6).getMessage());
- }
-
- this.field_0 = var1;
- }
-
- public DSAParams getParams() {
- try {
- if (super.algid instanceof DSAParams) {
- return (DSAParams)super.algid;
- } else {
- byte[] var1 = super.algid.encode();
- super.algid = new AlgIdDSA(var1);
- return (DSAParams)super.algid;
- }
- } catch (IOException var2) {
- throw new ProviderException("unable to parse algorithm params.");
- }
- }
-
- public BigInteger getX() {
- return this.field_0;
- }
-
- protected void parseKeyBits() throws InvalidKeyException {
- DerInputStream var1 = new DerInputStream(super.key);
-
- try {
- this.field_0 = var1.getInteger().toBigInteger();
- } catch (IOException var3) {
- throw new InvalidKeyException(((Throwable)var3).getMessage());
- }
- }
-
- byte[] getEncodedKey() throws InvalidKeyException {
- return ((PKCS8Key)this).getEncoded();
- }
-
- public String toString() {
- return "Sun DSA Private Key \nparameters:" + super.algid + "\nx: " + this.field_0.toString(16) + "\n";
- }
- }
-