1 package org.bouncycastle.asn1.x509;
3 import java.util.Enumeration;
4 import java.math.BigInteger;
6 import org.bouncycastle.asn1.*;
8 public class RSAPublicKeyStructure
9 implements DEREncodable
11 private BigInteger modulus;
12 private BigInteger publicExponent;
14 public RSAPublicKeyStructure(
16 BigInteger publicExponent)
18 this.modulus = modulus;
19 this.publicExponent = publicExponent;
22 public RSAPublicKeyStructure(
23 DERConstructedSequence seq)
25 Enumeration e = seq.getObjects();
27 modulus = ((DERInteger)e.nextElement()).getValue();
28 publicExponent = ((DERInteger)e.nextElement()).getValue();
31 public BigInteger getModulus()
36 public BigInteger getPublicExponent()
38 return publicExponent;
42 * This outputs the key in PKCS1v2 format.
44 * RSAPublicKey ::= SEQUENCE {
45 * modulus INTEGER, -- n
46 * publicExponent INTEGER, -- e
51 public DERObject getDERObject()
53 DERConstructedSequence seq = new DERConstructedSequence();
55 seq.addObject(new DERInteger(getModulus()));
56 seq.addObject(new DERInteger(getPublicExponent()));