コード例 #1
0
ファイル: custom.py プロジェクト: yaoshixin007/azure-cli
def _scaffold_certificate_profile():
    template = CertificatePolicy(
        key_properties=KeyProperties(
            exportable=True,
            key_type=u'(optional) RSA or RSA-HSM (default RSA)',
            key_size=2048,
            reuse_key=True),
        secret_properties=SecretProperties(
            content_type=u'application/x-pkcs12 or application/x-pem-file'),
        x509_certificate_properties=X509CertificateProperties(
            key_usage=[
                KeyUsageType.c_rl_sign, KeyUsageType.data_encipherment,
                KeyUsageType.digital_signature, KeyUsageType.key_encipherment,
                KeyUsageType.key_agreement, KeyUsageType.key_cert_sign
            ],
            subject_alternative_names=SubjectAlternativeNames(
                emails=[u'*****@*****.**'],
                dns_names=[u'hr.contoso.com', u'm.contoso.com'],
                upns=[]),
            subject=
            u'C=US, ST=WA, L=Redmond, O=Contoso, OU=Contoso HR, CN=www.contoso.com',
            ekus=[u'1.3.6.1.5.5.7.3.1'],
            validity_in_months=24),
        lifetime_actions=[
            LifetimeAction(trigger=Trigger(days_before_expiry=90),
                           action=Action(action_type=ActionType.auto_renew))
        ],
        issuer_parameters=IssuerParameters(
            name=u'Unknown, Self, or {IssuerName}',
            certificate_type=u'(optional) DigiCert, GlobalSign or WoSign'),
        attributes=CertificateAttributes(enabled=True))
    del template.id
    del template.attributes
    return template
コード例 #2
0
ファイル: custom.py プロジェクト: yaoshixin007/azure-cli
def _default_certificate_profile():
    template = CertificatePolicy(
        key_properties=KeyProperties(exportable=True,
                                     key_type=u'RSA',
                                     key_size=2048,
                                     reuse_key=True),
        secret_properties=SecretProperties(
            content_type=u'application/x-pkcs12'),
        x509_certificate_properties=X509CertificateProperties(
            key_usage=[
                KeyUsageType.c_rl_sign, KeyUsageType.data_encipherment,
                KeyUsageType.digital_signature, KeyUsageType.key_encipherment,
                KeyUsageType.key_agreement, KeyUsageType.key_cert_sign
            ],
            subject=u'CN=CLIGetDefaultPolicy',
            validity_in_months=12),
        lifetime_actions=[
            LifetimeAction(trigger=Trigger(days_before_expiry=90),
                           action=Action(action_type=ActionType.auto_renew))
        ],
        issuer_parameters=IssuerParameters(name=u'Self', ),
        attributes=CertificateAttributes(enabled=True))
    del template.id
    del template.attributes
    del template.issuer_parameters.certificate_type
    del template.lifetime_actions[0].trigger.lifetime_percentage
    del template.x509_certificate_properties.subject_alternative_names
    del template.x509_certificate_properties.ekus
    return template