Search in sources :

Example 1 with ExtendedKeyUsageType

use of org.kse.crypto.x509.ExtendedKeyUsageType in project keystore-explorer by kaikramer.

the class DExtendedKeyUsage method prepopulateWithValue.

private void prepopulateWithValue(byte[] value) throws IOException {
    ExtendedKeyUsage extendedKeyUsage = ExtendedKeyUsage.getInstance(value);
    for (KeyPurposeId keyPurposeId : extendedKeyUsage.getUsages()) {
        ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) keyPurposeId.toASN1Primitive();
        ExtendedKeyUsageType type = ExtendedKeyUsageType.resolveOid(oid.getId());
        if (type == SERVER_AUTH) {
            jcbTlsWebServerAuthentication.setSelected(true);
        } else if (type == CLIENT_AUTH) {
            jcbTlsWebClientAuthentication.setSelected(true);
        } else if (type == CODE_SIGNING) {
            jcbCodeSigning.setSelected(true);
        } else if (type == DOCUMENT_SIGNING) {
            jcbDocumentSigning.setSelected(true);
        } else if (type == ADOBE_PDF_SIGNING) {
            jcbAdobePDFSigning.setSelected(true);
        } else if (type == EMAIL_PROTECTION) {
            jcbEmailProtection.setSelected(true);
        } else if (type == ENCRYPTED_FILE_SYSTEM) {
            jcbEncryptedFileSystem.setSelected(true);
        } else if (type == IPSEC_END_SYSTEM) {
            jcbIpSecurityEndSystem.setSelected(true);
        } else if (type == IPSEC_TUNNEL) {
            jcbIpSecurityTunnelTermination.setSelected(true);
        } else if (type == IPSEC_USER) {
            jcbIpSecurityUser.setSelected(true);
        } else if (type == SMARTCARD_LOGON) {
            jcbSmartcardLogon.setSelected(true);
        } else if (type == TIME_STAMPING) {
            jcbTimeStamping.setSelected(true);
        } else if (type == OCSP_SIGNING) {
            jcbOcspStamping.setSelected(true);
        } else if (type == ANY_EXTENDED_KEY_USAGE) {
            jcbAnyExtendedKeyUsage.setSelected(true);
        }
    }
}
Also used : KeyPurposeId(org.bouncycastle.asn1.x509.KeyPurposeId) ExtendedKeyUsageType(org.kse.crypto.x509.ExtendedKeyUsageType) ExtendedKeyUsage(org.bouncycastle.asn1.x509.ExtendedKeyUsage) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Aggregations

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)1 ExtendedKeyUsage (org.bouncycastle.asn1.x509.ExtendedKeyUsage)1 KeyPurposeId (org.bouncycastle.asn1.x509.KeyPurposeId)1 ExtendedKeyUsageType (org.kse.crypto.x509.ExtendedKeyUsageType)1