Search in sources :

Example 1 with ConstantValueType

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

the class ProfileConfCreatorDemo method createQcStatements.

private static ExtensionValueType createQcStatements(boolean requireRequestExt) {
    QcStatements extValue = new QcStatements();
    QcStatementType statement = new QcStatementType();
    // QcCompliance
    statement.setStatementId(createOidType(ObjectIdentifiers.id_etsi_qcs_QcCompliance));
    extValue.getQcStatement().add(statement);
    // QC SCD
    statement = new QcStatementType();
    statement.setStatementId(createOidType(ObjectIdentifiers.id_etsi_qcs_QcSSCD));
    extValue.getQcStatement().add(statement);
    // QC RetentionPeriod
    statement = new QcStatementType();
    statement.setStatementId(createOidType(ObjectIdentifiers.id_etsi_qcs_QcRetentionPeriod));
    QcStatementValueType statementValue = new QcStatementValueType();
    statementValue.setQcRetentionPeriod(10);
    statement.setStatementValue(statementValue);
    extValue.getQcStatement().add(statement);
    // QC LimitValue
    statement = new QcStatementType();
    statement.setStatementId(createOidType(ObjectIdentifiers.id_etsi_qcs_QcLimitValue));
    statementValue = new QcStatementValueType();
    QcEuLimitValueType euLimit = new QcEuLimitValueType();
    euLimit.setCurrency("EUR");
    Range2Type rangeAmount = new Range2Type();
    int min = 100;
    rangeAmount.setMin(min);
    rangeAmount.setMax(requireRequestExt ? 200 : min);
    euLimit.setAmount(rangeAmount);
    Range2Type rangeExponent = new Range2Type();
    min = 10;
    rangeExponent.setMin(min);
    rangeExponent.setMax(requireRequestExt ? 20 : min);
    euLimit.setExponent(rangeExponent);
    statementValue.setQcEuLimitValue(euLimit);
    statement.setStatementValue(statementValue);
    extValue.getQcStatement().add(statement);
    // QC PDS
    statement = new QcStatementType();
    statement.setStatementId(createOidType(ObjectIdentifiers.id_etsi_qcs_QcPDS));
    extValue.getQcStatement().add(statement);
    statementValue = new QcStatementValueType();
    statement.setStatementValue(statementValue);
    PdsLocationsType pdsLocations = new PdsLocationsType();
    statementValue.setPdsLocations(pdsLocations);
    PdsLocationType pdsLocation = new PdsLocationType();
    pdsLocations.getPdsLocation().add(pdsLocation);
    pdsLocation.setUrl("http://pki.example.org/pds/en");
    pdsLocation.setLanguage("en");
    pdsLocation = new PdsLocationType();
    pdsLocations.getPdsLocation().add(pdsLocation);
    pdsLocation.setUrl("http://pki.example.org/pds/de");
    pdsLocation.setLanguage("de");
    // QC Constant value
    statement = new QcStatementType();
    statement.setStatementId(createOidType(new ASN1ObjectIdentifier("1.2.3.4.5"), "dummy"));
    statementValue = new QcStatementValueType();
    ConstantValueType value = new ConstantValueType();
    try {
        value.setValue(DERNull.INSTANCE.getEncoded());
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    value.setDescription("DER NULL");
    statementValue.setConstant(value);
    statement.setStatementValue(statementValue);
    extValue.getQcStatement().add(statement);
    return createExtensionValueType(extValue);
}
Also used : QcStatements(org.xipki.ca.certprofile.x509.jaxb.QcStatements) ConstantValueType(org.xipki.ca.certprofile.x509.jaxb.ConstantValueType) Range2Type(org.xipki.ca.certprofile.x509.jaxb.Range2Type) QcStatementValueType(org.xipki.ca.certprofile.x509.jaxb.QcStatementValueType) QcStatementType(org.xipki.ca.certprofile.x509.jaxb.QcStatementType) PdsLocationsType(org.xipki.ca.certprofile.x509.jaxb.PdsLocationsType) IOException(java.io.IOException) ASN1ObjectIdentifier(org.bouncycastle.asn1.ASN1ObjectIdentifier) QcEuLimitValueType(org.xipki.ca.certprofile.x509.jaxb.QcEuLimitValueType) PdsLocationType(org.xipki.ca.certprofile.x509.jaxb.PdsLocationType)

Example 2 with ConstantValueType

use of org.xipki.ca.certprofile.x509.jaxb.ConstantValueType 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

ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)2 ConstantValueType (org.xipki.ca.certprofile.x509.jaxb.ConstantValueType)2 IOException (java.io.IOException)1 AuthorizationTemplate (org.xipki.ca.certprofile.x509.jaxb.AuthorizationTemplate)1 PdsLocationType (org.xipki.ca.certprofile.x509.jaxb.PdsLocationType)1 PdsLocationsType (org.xipki.ca.certprofile.x509.jaxb.PdsLocationsType)1 QcEuLimitValueType (org.xipki.ca.certprofile.x509.jaxb.QcEuLimitValueType)1 QcStatementType (org.xipki.ca.certprofile.x509.jaxb.QcStatementType)1 QcStatementValueType (org.xipki.ca.certprofile.x509.jaxb.QcStatementValueType)1 QcStatements (org.xipki.ca.certprofile.x509.jaxb.QcStatements)1 Range2Type (org.xipki.ca.certprofile.x509.jaxb.Range2Type)1