01: package org.bouncycastle.asn1.oiw;
02:
03: import java.math.*;
04: import java.util.*;
05:
06: import org.bouncycastle.asn1.*;
07:
08: public class ElGamalParameter extends ASN1Encodable {
09: DERInteger p, g;
10:
11: public ElGamalParameter(BigInteger p, BigInteger g) {
12: this .p = new DERInteger(p);
13: this .g = new DERInteger(g);
14: }
15:
16: public ElGamalParameter(ASN1Sequence seq) {
17: Enumeration e = seq.getObjects();
18:
19: p = (DERInteger) e.nextElement();
20: g = (DERInteger) e.nextElement();
21: }
22:
23: public BigInteger getP() {
24: return p.getPositiveValue();
25: }
26:
27: public BigInteger getG() {
28: return g.getPositiveValue();
29: }
30:
31: public DERObject toASN1Object() {
32: ASN1EncodableVector v = new ASN1EncodableVector();
33:
34: v.add(p);
35: v.add(g);
36:
37: return new DERSequence(v);
38: }
39: }
|