首页 > 解决方案 > CFSSL 配置与 OpenSSL 配置

问题描述

有谁知道您可以在 OpenSSL 配置文件中指定的所有字段是否在 Cloudflare 的 CFSSL 证书颁发机构工具包中可用?default_mdCFSSL 在其 JSON 配置文件(以下是其中的摘录)中识别的选项中似乎缺少某些字段(例如或指定国家必须匹配):

type CAConstraint struct {
    IsCA           bool `json:"is_ca"`
    MaxPathLen     int  `json:"max_path_len"`
    MaxPathLenZero bool `json:"max_path_len_zero"`
}

// A SigningProfile stores information that the CA needs to store
// signature policy.
type SigningProfile struct {
    Usage               []string     `json:"usages"`
    IssuerURL           []string     `json:"issuer_urls"`
    OCSP                string       `json:"ocsp_url"`
    CRL                 string       `json:"crl_url"`
    CAConstraint        CAConstraint `json:"ca_constraint"`
    OCSPNoCheck         bool         `json:"ocsp_no_check"`
    ExpiryString        string       `json:"expiry"`
    BackdateString      string       `json:"backdate"`
    AuthKeyName         string       `json:"auth_key"`
    RemoteName          string       `json:"remote"`
    NotBefore           time.Time    `json:"not_before"`
    NotAfter            time.Time    `json:"not_after"`
    NameWhitelistString string       `json:"name_whitelist"`
    AuthRemote          AuthRemote   `json:"auth_remote"`
    CTLogServers        []string     `json:"ct_log_servers"`
    AllowedExtensions   []OID        `json:"allowed_extensions"`
    CertStore           string       `json:"cert_store"`

    Policies                    []CertificatePolicy
    Expiry                      time.Duration
    Backdate                    time.Duration
    Provider                    auth.Provider
    RemoteProvider              auth.Provider
    RemoteServer                string
    RemoteCAs                   *x509.CertPool
    ClientCert                  *tls.Certificate
    CSRWhitelist                *CSRWhitelist
    NameWhitelist               *regexp.Regexp
    ExtensionWhitelist          map[string]bool
    ClientProvidesSerialNumbers bool
}

CFSSL 是否抽象了许多 OpenSSL 配置选项,或者我只是没有看到您可以在哪里指定它们?

标签: opensslconfigcertificate-authority

解决方案


消息摘要算法似乎是动态选择的,并且取决于 CA 私钥的长度。

func DefaultSigAlgo(priv crypto.Signer) x509.SignatureAlgorithm {
    pub := priv.Public()
    switch pub := pub.(type) {
    case *rsa.PublicKey:
        keySize := pub.N.BitLen()
        switch {
        case keySize >= 4096:
            return x509.SHA512WithRSA
        case keySize >= 3072:
            return x509.SHA384WithRSA
        case keySize >= 2048:
            return x509.SHA256WithRSA
        default:
            return x509.SHA1WithRSA
        } ...

基于我在 Github 上的 CFSSL 源代码中找到的内容。

关于县,我无法在代码中找到任何限制或配置它的限制,可以假设所有国家都被允许。


推荐阅读