Search in sources :

Example 21 with ExtensionValueType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.

the class ProfileConfCreatorDemo method createPrivateKeyUsagePeriod.

private static ExtensionValueType createPrivateKeyUsagePeriod(String validity) {
    PrivateKeyUsagePeriod extValue = new PrivateKeyUsagePeriod();
    extValue.setValidity(validity);
    return createExtensionValueType(extValue);
}
Also used : PrivateKeyUsagePeriod(org.xipki.ca.certprofile.x509.jaxb.PrivateKeyUsagePeriod)

Example 22 with ExtensionValueType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.

the class ProfileConfCreatorDemo method certprofileCross.

// method certprofileRootCa
private static X509ProfileType certprofileCross() throws Exception {
    X509ProfileType profile = getBaseProfile("certprofile cross", X509CertLevel.SubCA, "10y", false);
    // Subject
    Subject subject = profile.getSubject();
    subject.setIncSerialNumber(false);
    List<RdnType> rdnControls = subject.getRdn();
    rdnControls.add(createRdn(ObjectIdentifiers.DN_C, 1, 1, new String[] { "DE|FR" }, null, null));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_O, 1, 1));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_OU, 0, 1));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_SN, 0, 1, new String[] { REGEX_SN }, null, null));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_CN, 1, 1));
    // Extensions
    ExtensionsType extensions = profile.getExtensions();
    List<ExtensionType> list = extensions.getExtension();
    list.add(createExtension(Extension.subjectKeyIdentifier, true, false, null));
    list.add(createExtension(Extension.cRLDistributionPoints, false, false, null));
    list.add(createExtension(Extension.freshestCRL, false, false, null));
    // Extensions - basicConstraints
    ExtensionValueType extensionValue = null;
    list.add(createExtension(Extension.basicConstraints, true, true, extensionValue));
    // Extensions - AuthorityInfoAccess
    extensionValue = createAuthorityInfoAccess();
    list.add(createExtension(Extension.authorityInfoAccess, true, false, extensionValue));
    // Extensions - AuthorityKeyIdentifier
    extensionValue = createAuthorityKeyIdentifier(false);
    list.add(createExtension(Extension.authorityKeyIdentifier, true, false, extensionValue));
    // Extensions - keyUsage
    extensionValue = createKeyUsages(new KeyUsageEnum[] { KeyUsageEnum.KEY_CERT_SIGN }, null);
    list.add(createExtension(Extension.keyUsage, true, true, extensionValue));
    return profile;
}
Also used : ExtensionsType(org.xipki.ca.certprofile.x509.jaxb.ExtensionsType) ExtensionType(org.xipki.ca.certprofile.x509.jaxb.ExtensionType) TlsExtensionType(org.xipki.security.TlsExtensionType) X509ProfileType(org.xipki.ca.certprofile.x509.jaxb.X509ProfileType) ExtensionValueType(org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType) Subject(org.xipki.ca.certprofile.x509.jaxb.X509ProfileType.Subject) RdnType(org.xipki.ca.certprofile.x509.jaxb.RdnType) KeyUsageEnum(org.xipki.ca.certprofile.x509.jaxb.KeyUsageEnum)

Example 23 with ExtensionValueType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.

the class ProfileConfCreatorDemo method createTlsFeature.

private static ExtensionValueType createTlsFeature(TlsExtensionType[] features) {
    List<TlsExtensionType> exts = Arrays.asList(features);
    Collections.sort(exts);
    TlsFeature tlsFeature = new TlsFeature();
    for (TlsExtensionType m : exts) {
        IntWithDescType ints = new IntWithDescType();
        ints.setValue(m.getCode());
        ints.setDescription(m.getName());
        tlsFeature.getFeature().add(ints);
    }
    return createExtensionValueType(tlsFeature);
}
Also used : TlsFeature(org.xipki.ca.certprofile.x509.jaxb.TlsFeature) TlsExtensionType(org.xipki.security.TlsExtensionType) IntWithDescType(org.xipki.ca.certprofile.x509.jaxb.IntWithDescType)

Example 24 with ExtensionValueType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.

the class ProfileConfCreatorDemo method certprofileRootCa.

// method marshal
private static X509ProfileType certprofileRootCa() throws Exception {
    X509ProfileType profile = getBaseProfile("certprofile rootca", X509CertLevel.RootCA, "10y", false);
    // Subject
    Subject subject = profile.getSubject();
    subject.setIncSerialNumber(false);
    List<RdnType> rdnControls = subject.getRdn();
    rdnControls.add(createRdn(ObjectIdentifiers.DN_C, 1, 1, new String[] { "DE|FR" }, null, null));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_O, 1, 1));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_OU, 0, 1));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_SN, 0, 1, new String[] { REGEX_SN }, null, null));
    rdnControls.add(createRdn(ObjectIdentifiers.DN_CN, 1, 1));
    // Extensions
    ExtensionsType extensions = profile.getExtensions();
    List<ExtensionType> list = extensions.getExtension();
    list.add(createExtension(Extension.subjectKeyIdentifier, true, false, null));
    list.add(createExtension(Extension.cRLDistributionPoints, false, false, null));
    list.add(createExtension(Extension.freshestCRL, false, false, null));
    // Extensions - basicConstraints
    ExtensionValueType extensionValue = null;
    list.add(createExtension(Extension.basicConstraints, true, true, extensionValue));
    // Extensions - AuthorityInfoAccess
    extensionValue = createAuthorityInfoAccess();
    list.add(createExtension(Extension.authorityInfoAccess, true, false, extensionValue));
    // Extensions - keyUsage
    extensionValue = createKeyUsages(new KeyUsageEnum[] { KeyUsageEnum.KEY_CERT_SIGN }, new KeyUsageEnum[] { KeyUsageEnum.CRL_SIGN });
    list.add(createExtension(Extension.keyUsage, true, true, extensionValue));
    return profile;
}
Also used : ExtensionsType(org.xipki.ca.certprofile.x509.jaxb.ExtensionsType) ExtensionType(org.xipki.ca.certprofile.x509.jaxb.ExtensionType) TlsExtensionType(org.xipki.security.TlsExtensionType) X509ProfileType(org.xipki.ca.certprofile.x509.jaxb.X509ProfileType) ExtensionValueType(org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType) Subject(org.xipki.ca.certprofile.x509.jaxb.X509ProfileType.Subject) RdnType(org.xipki.ca.certprofile.x509.jaxb.RdnType) KeyUsageEnum(org.xipki.ca.certprofile.x509.jaxb.KeyUsageEnum)

Example 25 with ExtensionValueType

use of org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType in project xipki by xipki.

the class ProfileConfCreatorDemo method createAuthorizationTemplate.

// method createBiometricInfo
private static ExtensionValueType createAuthorizationTemplate() {
    AuthorizationTemplate extValue = new AuthorizationTemplate();
    extValue.setType(createOidType(new ASN1ObjectIdentifier("1.2.3.4.5"), "dummy type"));
    ConstantValueType accessRights = new ConstantValueType();
    accessRights.setDescription("dummy access rights");
    accessRights.setValue(new byte[] { 1, 2, 3, 4 });
    extValue.setAccessRights(accessRights);
    return createExtensionValueType(extValue);
}
Also used : ConstantValueType(org.xipki.ca.certprofile.x509.jaxb.ConstantValueType) AuthorizationTemplate(org.xipki.ca.certprofile.x509.jaxb.AuthorizationTemplate) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier)

Aggregations

TlsExtensionType (org.xipki.security.TlsExtensionType)18 ExtensionType (org.xipki.ca.certprofile.x509.jaxb.ExtensionType)17 ExtensionValueType (org.xipki.ca.certprofile.x509.jaxb.ExtensionValueType)17 KeyUsageEnum (org.xipki.ca.certprofile.x509.jaxb.KeyUsageEnum)17 ExtensionsType (org.xipki.ca.certprofile.x509.jaxb.ExtensionsType)16 RdnType (org.xipki.ca.certprofile.x509.jaxb.RdnType)16 X509ProfileType (org.xipki.ca.certprofile.x509.jaxb.X509ProfileType)16 Subject (org.xipki.ca.certprofile.x509.jaxb.X509ProfileType.Subject)16 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)15 SubjectAltName (org.xipki.ca.certprofile.x509.jaxb.SubjectAltName)4 IOException (java.io.IOException)3 AuthorityInfoAccess (org.xipki.ca.certprofile.x509.jaxb.AuthorityInfoAccess)3 AdmissionSyntax (org.xipki.ca.certprofile.x509.jaxb.AdmissionSyntax)2 AdmissionsType (org.xipki.ca.certprofile.x509.jaxb.AdmissionsType)2 CertificatePolicies (org.xipki.ca.certprofile.x509.jaxb.CertificatePolicies)2 CertificatePolicyInformationType (org.xipki.ca.certprofile.x509.jaxb.CertificatePolicyInformationType)2 ConstantValueType (org.xipki.ca.certprofile.x509.jaxb.ConstantValueType)2 ExtendedKeyUsage (org.xipki.ca.certprofile.x509.jaxb.ExtendedKeyUsage)2 GeneralNameType (org.xipki.ca.certprofile.x509.jaxb.GeneralNameType)2 OtherName (org.xipki.ca.certprofile.x509.jaxb.GeneralNameType.OtherName)2