Example usage for org.bouncycastle.asn1 BERTags INTEGER

List of usage examples for org.bouncycastle.asn1 BERTags INTEGER

Introduction

In this page you can find the example usage for org.bouncycastle.asn1 BERTags INTEGER.

Prototype

int INTEGER

To view the source code for org.bouncycastle.asn1 BERTags INTEGER.

Click Source Link

Usage

From source file:de.tsenger.animamea.asn1.AmDHPublicKey.java

License:Open Source License

/** Returns prime modulus p
 * @return//from ww  w .j  a va2 s . c o m
 */
public BigInteger getP() {
    if (p == null)
        return null;
    ASN1Integer derInt = (ASN1Integer) p.getObjectParser(BERTags.INTEGER, false);
    return derInt.getPositiveValue();
}

From source file:de.tsenger.animamea.asn1.AmDHPublicKey.java

License:Open Source License

/** Returns generator g
 * @return/*w w w .  jav a  2 s .c om*/
 */
public BigInteger getG() {
    if (g == null)
        return null;
    ASN1Integer derInt = (ASN1Integer) g.getObjectParser(BERTags.INTEGER, false);
    return derInt.getPositiveValue();
}

From source file:de.tsenger.animamea.asn1.AmDHPublicKey.java

License:Open Source License

/** Returns oder of the subgroup q
 * @return/*  w  w  w.ja v  a  2s  .  c om*/
 */
public BigInteger getQ() {
    if (q == null)
        return null;
    ASN1Integer derInt = (ASN1Integer) q.getObjectParser(BERTags.INTEGER, false);
    return derInt.getPositiveValue();
}

From source file:de.tsenger.animamea.asn1.AmDHPublicKey.java

License:Open Source License

@Override
public BigInteger getY() {
    if (y == null)
        return null;
    ASN1Integer derInt = (ASN1Integer) y.getObjectParser(BERTags.INTEGER, false);
    return derInt.getPositiveValue();
}

From source file:de.tsenger.animamea.asn1.AmRSAPublicKey.java

License:Open Source License

@Override
public BigInteger getModulus() {
    if (n == null)
        return null;
    ASN1Integer derInt = (ASN1Integer) n.getObjectParser(BERTags.INTEGER, false);
    return derInt.getPositiveValue();
}

From source file:de.tsenger.animamea.asn1.AmRSAPublicKey.java

License:Open Source License

@Override
public BigInteger getPublicExponent() {
    if (e == null)
        return null;
    ASN1Integer derInt = (ASN1Integer) e.getObjectParser(BERTags.INTEGER, false);
    return derInt.getPositiveValue();
}

From source file:de.tsenger.animamea.asn1.CVCertBody.java

License:Open Source License

public CVCertBody(DERApplicationSpecific derApp) throws IllegalArgumentException, IOException {
    if (derApp.getApplicationTag() != 0x4E)
        throw new IllegalArgumentException("contains no Certifcate Body with tag 0x7F4E");
    else/*  w  ww  . j a v a2 s  . co m*/
        cvcbody = derApp;

    ASN1Sequence bodySeq = (ASN1Sequence) cvcbody.getObject(BERTags.SEQUENCE);
    profileIdentifier = (ASN1Integer) ((DERApplicationSpecific) bodySeq.getObjectAt(0))
            .getObject(BERTags.INTEGER);
    authorityReference = (DERIA5String) ((DERApplicationSpecific) bodySeq.getObjectAt(1))
            .getObject(BERTags.IA5_STRING);

    ASN1Sequence pkSeq = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(2))
            .getObject(BERTags.SEQUENCE);
    ASN1ObjectIdentifier pkOid = (ASN1ObjectIdentifier) pkSeq.getObjectAt(0);
    if (pkOid.toString().startsWith("0.4.0.127.0.7.2.2.2.2")) {
        publicKey = new AmECPublicKey(pkSeq);
    } else if (pkOid.toString().startsWith("0.4.0.127.0.7.2.2.2.1")) {
        publicKey = new AmRSAPublicKey(pkSeq);
    }

    chr = (DERIA5String) ((DERApplicationSpecific) bodySeq.getObjectAt(3)).getObject(BERTags.IA5_STRING);

    ASN1Sequence chatSeq = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(4))
            .getObject(BERTags.SEQUENCE);
    chat = new CertificateHolderAuthorizationTemplate(chatSeq);

    effectiveDate = (DEROctetString) ((DERApplicationSpecific) bodySeq.getObjectAt(5))
            .getObject(BERTags.OCTET_STRING);

    expirationDate = (DEROctetString) ((DERApplicationSpecific) bodySeq.getObjectAt(6))
            .getObject(BERTags.OCTET_STRING);

    if (bodySeq.size() > 7) {
        extensions = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(7))
                .getObject(BERTags.SEQUENCE);
    }
}