Example usage for org.bouncycastle.asn1 ASN1EncodableVector ASN1EncodableVector

List of usage examples for org.bouncycastle.asn1 ASN1EncodableVector ASN1EncodableVector

Introduction

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

Prototype

public ASN1EncodableVector() 

Source Link

Usage

From source file:com.novosec.pkix.asn1.crmf.PBMParameter.java

License:Open Source License

public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(salt);//from w w w .java2 s .c o  m
    v.add(owf);
    v.add(iterationCount);
    v.add(mac);

    return new DERSequence(v);
}

From source file:com.novosec.pkix.asn1.crmf.PKIPublicationInfo.java

License:Open Source License

public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(action);/*from   w  w  w  .  ja  v a2  s  .c om*/

    if (pubInfos.size() > 0) {
        ASN1EncodableVector pubiv = new ASN1EncodableVector();
        for (int i = 0; i < pubInfos.size(); i++) {
            pubiv.add((SinglePubInfo) pubInfos.elementAt(i));
        }
        v.add(new DERSequence(pubiv));
    }

    return new DERSequence(v);
}

From source file:com.novosec.pkix.asn1.crmf.PKMACValue.java

License:Open Source License

public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(algId);
    v.add(value);

    return new DERSequence(v);
}

From source file:com.novosec.pkix.asn1.crmf.POPOSigningKey.java

License:Open Source License

public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (poposkInput != null) {
        v.add(new DERTaggedObject(false, 0, poposkInput));
    }//from  w  w  w .j av a  2s.c o  m
    v.add(algorithmIdentifier);
    v.add(signature);

    return new DERSequence(v);
}

From source file:com.novosec.pkix.asn1.crmf.POPOSigningKeyInput.java

License:Open Source License

public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    if (sender != null) {
        v.add(new DERTaggedObject(false, 0, sender));
    } else {/*from   ww w  . j  ava 2 s .c om*/
        v.add(publicKeyMAC);
    }

    v.add(publicKey);

    return new DERSequence(v);
}

From source file:com.novosec.pkix.asn1.crmf.SinglePubInfo.java

License:Open Source License

public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(pubMethod);/*from  w ww  .ja v  a2  s.  c  om*/

    if (pubLocation != null) {
        v.add(pubLocation);
    }

    return new DERSequence(v);
}

From source file:com.otterca.common.crypto.SimplePolicyGeneratorImpl.java

License:Apache License

/**
 * Get user notification policy information.
 * /*from  w w  w .  j av  a  2s  .  com*/
 * @return
 */
public PolicyInformation getUserNoticePolicyInformation() {
    PolicyInformation unotice = null;
    if ((organization != null) && (userNotice != null)) {
        ASN1EncodableVector noticeNumbers = new ASN1EncodableVector();
        if (noticeNumber != null) {
            noticeNumbers.add(new DERInteger(noticeNumber.intValue()));
        }
        NoticeReference noticeReference = new NoticeReference(organization, noticeNumbers);
        unotice = new PolicyInformation(id_qt_unotice,
                new DERSequence(new UserNotice(noticeReference, new DisplayText(userNotice))));
    }
    return unotice;
}

From source file:com.peterphi.std.crypto.keygen.CaHelper.java

License:Open Source License

public static PKCS10CertificationRequest generateCertificateRequest(X509Certificate cert, PrivateKey signingKey)
        throws Exception {
    ASN1EncodableVector attributes = new ASN1EncodableVector();

    Set<String> nonCriticalExtensionOIDs = cert.getNonCriticalExtensionOIDs();
    for (String nceoid : nonCriticalExtensionOIDs) {
        byte[] derBytes = cert.getExtensionValue(nceoid);
        ByteArrayInputStream bis = new ByteArrayInputStream(derBytes);
        ASN1InputStream dis = new ASN1InputStream(bis);
        try {/*from ww  w  .  jav a 2  s  .  c  o m*/
            DERObject derObject = dis.readObject();
            DERSet value = new DERSet(derObject);
            Attribute attr = new Attribute(new DERObjectIdentifier(nceoid), value);
            attributes.add(attr);
        } finally {
            IOUtils.closeQuietly(dis);
        }
    }
    PKCS10CertificationRequest certificationRequest = new PKCS10CertificationRequest(getSignatureAlgorithm(),
            cert.getSubjectX500Principal(), cert.getPublicKey(), new DERSet(attributes), signingKey);
    return certificationRequest;
}

From source file:com.raphfrk.craftproxyclient.net.protocol.p16x.P16xProtocol.java

License:Open Source License

public byte[] encodeRSAPublicKey(RSAKeyParameters key) {
    if (((RSAKeyParameters) key).isPrivate()) {
        return null;
    }//from w w w . j  a  va 2 s .  c o  m

    RSAKeyParameters rsaKey = (RSAKeyParameters) key;

    ASN1EncodableVector encodable = new ASN1EncodableVector();
    encodable.add(new ASN1Integer(rsaKey.getModulus()));
    encodable.add(new ASN1Integer(rsaKey.getExponent()));

    return KeyUtil.getEncodedSubjectPublicKeyInfo(
            new AlgorithmIdentifier(PKCSObjectIdentifiers.rsaEncryption, DERNull.INSTANCE),
            new DERSequence(encodable));
}

From source file:com.rcn.service.CertificateService.java

License:Open Source License

private void addCaExtension(JcaX509v3CertificateBuilder v3CertGen) {
    v3CertGen.addExtension(X509Extension.basicConstraints, false, new BasicConstraints(true));

    v3CertGen.addExtension(X509Extension.keyUsage, false,
            new KeyUsage(KeyUsage.keyCertSign | KeyUsage.cRLSign));

    ASN1EncodableVector intPolicies = new ASN1EncodableVector();

    intPolicies.add(new PolicyInformation(new DERObjectIdentifier(ANY_POLICY)));

    v3CertGen.addExtension(X509Extension.certificatePolicies, false, new DERSequence(intPolicies));
}