FileDocCategorySizeDatePackage
JDKDSAPublicKey.javaAPI DocAndroid 1.5 API3423Wed May 06 22:41:06 BST 2009org.bouncycastle.jce.provider

JDKDSAPublicKey

public class JDKDSAPublicKey extends Object implements DSAPublicKey

Fields Summary
private BigInteger
y
private DSAParams
dsaSpec
Constructors Summary
JDKDSAPublicKey(DSAPublicKeySpec spec)

        this.y = spec.getY();
        this.dsaSpec = new DSAParameterSpec(spec.getP(), spec.getQ(), spec.getG());
    
JDKDSAPublicKey(DSAPublicKey key)

        this.y = key.getY();
        this.dsaSpec = key.getParams();
    
JDKDSAPublicKey(org.bouncycastle.crypto.params.DSAPublicKeyParameters params)

        this.y = params.getY();
        this.dsaSpec = new DSAParameterSpec(params.getParameters().getP(), params.getParameters().getQ(), params.getParameters().getG());
    
JDKDSAPublicKey(BigInteger y, DSAParameterSpec dsaSpec)

        this.y = y;
        this.dsaSpec = dsaSpec;
    
JDKDSAPublicKey(org.bouncycastle.asn1.x509.SubjectPublicKeyInfo info)

        DSAParameter            params = new DSAParameter((ASN1Sequence)info.getAlgorithmId().getParameters());
        DERInteger              derY = null;

        try
        {
            derY = (DERInteger)info.getPublicKey();
        }
        catch (IOException e)
        {
            throw new IllegalArgumentException("invalid info structure in DSA public key");
        }

        this.y = derY.getValue();
        this.dsaSpec = new DSAParameterSpec(params.getP(), params.getQ(), params.getG());
    
Methods Summary
public booleanequals(java.lang.Object o)

        if (!(o instanceof DSAPublicKey))
        {
            return false;
        }
        
        DSAPublicKey other = (DSAPublicKey)o;
        
        return this.getY().equals(other.getY()) 
            && this.getParams().getG().equals(other.getParams().getG()) 
            && this.getParams().getP().equals(other.getParams().getP()) 
            && this.getParams().getQ().equals(other.getParams().getQ());
    
public java.lang.StringgetAlgorithm()

        return "DSA";
    
public byte[]getEncoded()

        SubjectPublicKeyInfo    info = new SubjectPublicKeyInfo(new AlgorithmIdentifier(X9ObjectIdentifiers.id_dsa, new DSAParameter(dsaSpec.getP(), dsaSpec.getQ(), dsaSpec.getG()).getDERObject()), new DERInteger(y));

        return info.getDEREncoded();
    
public java.lang.StringgetFormat()

        return "X.509";
    
public java.security.interfaces.DSAParamsgetParams()

        return dsaSpec;
    
public java.math.BigIntegergetY()

        return y;
    
public java.lang.StringtoString()

        StringBuffer    buf = new StringBuffer();
        String          nl = System.getProperty("line.separator");

        buf.append("DSA Public Key").append(nl);
        buf.append("            y: ").append(this.getY().toString(16)).append(nl);

        return buf.toString();