1 package org.bouncycastle.asn1.x509;
3 import java.math.BigInteger;
6 import org.bouncycastle.asn1.*;
8 public class DSAParameter
9 implements DEREncodable
13 public static DSAParameter getInstance(
17 return getInstance(ASN1Sequence.getInstance(obj, explicit));
20 public static DSAParameter getInstance(
23 if(obj == null || obj instanceof DSAParameter)
25 return (DSAParameter)obj;
28 if(obj instanceof ASN1Sequence)
30 return new DSAParameter((ASN1Sequence)obj);
33 throw new IllegalArgumentException("Invalid DSAParameter: " + obj.getClass().getName());
41 this.p = new DERInteger(p);
42 this.q = new DERInteger(q);
43 this.g = new DERInteger(g);
49 Enumeration e = seq.getObjects();
51 p = (DERInteger)e.nextElement();
52 q = (DERInteger)e.nextElement();
53 g = (DERInteger)e.nextElement();
56 public BigInteger getP()
58 return p.getPositiveValue();
61 public BigInteger getQ()
63 return q.getPositiveValue();
66 public BigInteger getG()
68 return g.getPositiveValue();
71 public DERObject getDERObject()
73 DEREncodableVector v = new DEREncodableVector();
79 return new DERSequence(v);