Search in sources :

Example 76 with ASN1EncodableVector

use of org.openecard.bouncycastle.asn1.ASN1EncodableVector in project BiglyBT by BiglySoftware.

the class EncryptionScheme method getDERObject.

@Override
public DERObject getDERObject() {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(objectId);
    v.add(obj);
    return new DERSequence(v);
}
Also used : DERSequence(org.gudy.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.gudy.bouncycastle.asn1.ASN1EncodableVector)

Example 77 with ASN1EncodableVector

use of org.openecard.bouncycastle.asn1.ASN1EncodableVector in project keystore-explorer by kaikramer.

the class PolicyMapping method toASN1Primitive.

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector dv = new ASN1EncodableVector();
    dv.add(issuerDomainPolicy);
    dv.add(subjectDomainPolicy);
    return new DERSequence(dv);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 78 with ASN1EncodableVector

use of org.openecard.bouncycastle.asn1.ASN1EncodableVector in project keystore-explorer by kaikramer.

the class SubjectInfoAccess method toASN1Primitive.

@Override
public ASN1Primitive toASN1Primitive() {
    ASN1EncodableVector vec = new ASN1EncodableVector();
    Iterator<AccessDescription> it = accessDescriptions.iterator();
    while (it.hasNext()) {
        vec.add(it.next().toASN1Primitive());
    }
    return new DERSequence(vec);
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) AccessDescription(org.bouncycastle.asn1.x509.AccessDescription) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector)

Example 79 with ASN1EncodableVector

use of org.openecard.bouncycastle.asn1.ASN1EncodableVector in project keystore-explorer by kaikramer.

the class DPolicyInformationChooser method okPressed.

private void okPressed() {
    ASN1ObjectIdentifier policyIdentifer = joiPolicyIdentifier.getObjectId();
    if (policyIdentifer == null) {
        JOptionPane.showMessageDialog(this, res.getString("DPolicyInformationChooser.PolicyIdentifierValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
        return;
    }
    List<PolicyQualifierInfo> policyQualifierInfo = jpqPolicyQualifiers.getPolicyQualifierInfo();
    if (policyQualifierInfo.size() > 0) {
        ASN1EncodableVector policyQualifiersVec = new ASN1EncodableVector();
        for (PolicyQualifierInfo policyQualInfo : policyQualifierInfo) {
            try {
                policyQualifiersVec.add(policyQualInfo);
            } catch (Exception ex) {
                DError dError = new DError(this, ex);
                dError.setLocationRelativeTo(this);
                dError.setVisible(true);
                return;
            }
        }
        DERSequence policyQualifiersSeq = new DERSequence(policyQualifiersVec);
        policyInformation = new PolicyInformation(policyIdentifer, policyQualifiersSeq);
    } else {
        policyInformation = new PolicyInformation(policyIdentifer);
    }
    closeDialog();
}
Also used : DERSequence(org.bouncycastle.asn1.DERSequence) PolicyInformation(org.bouncycastle.asn1.x509.PolicyInformation) PolicyQualifierInfo(org.bouncycastle.asn1.x509.PolicyQualifierInfo) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) IOException(java.io.IOException) DError(org.kse.gui.error.DError)

Example 80 with ASN1EncodableVector

use of org.openecard.bouncycastle.asn1.ASN1EncodableVector in project keystore-explorer by kaikramer.

the class DGeneralNameChooser method okPressed.

private void okPressed() {
    try {
        GeneralName newGeneralName = null;
        if (jrbDirectoryName.isSelected()) {
            X500Name directoryName = jdnDirectoryName.getDistinguishedName();
            if (directoryName == null) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.DirectoryNameValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newGeneralName = new GeneralName(GeneralName.directoryName, directoryName);
        } else if (jrbDnsName.isSelected()) {
            String dnsName = jtfDnsName.getText().trim();
            if (dnsName.length() == 0) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.DnsNameValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newGeneralName = new GeneralName(GeneralName.dNSName, new DERIA5String(dnsName));
        } else if (jrbIpAddress.isSelected()) {
            String ipAddress = jtfIpAddress.getText().trim();
            if (ipAddress.length() == 0) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.IpAddressValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            if (!IPAddress.isValid(ipAddress)) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.NotAValidIP.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newGeneralName = new GeneralName(GeneralName.iPAddress, ipAddress);
        } else if (jrbRegisteredId.isSelected()) {
            ASN1ObjectIdentifier registeredId = joiRegisteredId.getObjectId();
            if (registeredId == null) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.RegisteredIdValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newGeneralName = new GeneralName(GeneralName.registeredID, registeredId);
        } else if (jrbRfc822Name.isSelected()) {
            String rfc822Name = jtfRfc822Name.getText().trim();
            if (rfc822Name.length() == 0) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.Rfc822NameValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newGeneralName = new GeneralName(GeneralName.rfc822Name, new DERIA5String(rfc822Name));
        } else if (jrbUniformResourceIdentifier.isSelected()) {
            String uniformResourceIdentifier = jtfUniformResourceIdentifier.getText().trim();
            if (uniformResourceIdentifier.length() == 0) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.UniformResourceIdentifierValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            newGeneralName = new GeneralName(GeneralName.uniformResourceIdentifier, new DERIA5String(uniformResourceIdentifier));
        } else if (jrbPrincipalName.isSelected()) {
            String upnString = jtfPrincipalName.getText().trim();
            if (upnString.length() == 0) {
                JOptionPane.showMessageDialog(this, res.getString("DGeneralNameChooser.PrincipalNameValueReq.message"), getTitle(), JOptionPane.WARNING_MESSAGE);
                return;
            }
            ASN1EncodableVector asn1Vector = new ASN1EncodableVector();
            asn1Vector.add(new ASN1ObjectIdentifier(GeneralNameUtil.UPN_OID));
            asn1Vector.add(new DERTaggedObject(true, 0, new DERUTF8String(upnString)));
            newGeneralName = new GeneralName(GeneralName.otherName, new DERSequence(asn1Vector));
        }
        generalName = newGeneralName;
    } catch (Exception ex) {
        DError dError = new DError(this, ex);
        dError.setLocationRelativeTo(this);
        dError.setVisible(true);
        return;
    }
    closeDialog();
}
Also used : DERUTF8String(org.bouncycastle.asn1.DERUTF8String) DERIA5String(org.bouncycastle.asn1.DERIA5String) DERSequence(org.bouncycastle.asn1.DERSequence) DERTaggedObject(org.bouncycastle.asn1.DERTaggedObject) ASN1EncodableVector(org.bouncycastle.asn1.ASN1EncodableVector) GeneralName(org.bouncycastle.asn1.x509.GeneralName) X500Name(org.bouncycastle.asn1.x500.X500Name) ASN1OctetString(org.bouncycastle.asn1.ASN1OctetString) DERIA5String(org.bouncycastle.asn1.DERIA5String) DERUTF8String(org.bouncycastle.asn1.DERUTF8String) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) UnknownHostException(java.net.UnknownHostException) DError(org.kse.gui.error.DError)

Aggregations

ASN1EncodableVector (org.bouncycastle.asn1.ASN1EncodableVector)246 DERSequence (org.bouncycastle.asn1.DERSequence)196 ASN1Integer (org.bouncycastle.asn1.ASN1Integer)54 IOException (java.io.IOException)45 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)43 DERTaggedObject (org.bouncycastle.asn1.DERTaggedObject)42 DEROctetString (org.bouncycastle.asn1.DEROctetString)32 ASN1Sequence (org.bouncycastle.asn1.ASN1Sequence)24 DERUTF8String (org.bouncycastle.asn1.DERUTF8String)21 DLSequence (org.bouncycastle.asn1.DLSequence)21 BigInteger (java.math.BigInteger)20 X509Certificate (java.security.cert.X509Certificate)20 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)18 DERSet (org.bouncycastle.asn1.DERSet)18 ArrayList (java.util.ArrayList)17 DERBitString (org.bouncycastle.asn1.DERBitString)17 AlgorithmIdentifier (org.bouncycastle.asn1.x509.AlgorithmIdentifier)16 BERSequence (org.bouncycastle.asn1.BERSequence)14 DERIA5String (org.bouncycastle.asn1.DERIA5String)14 DERInteger (org.bouncycastle.asn1.DERInteger)14