Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why limit x509 Extended Key Usages? #5091

Open
johannww opened this issue Jan 2, 2025 · 0 comments
Open

Why limit x509 Extended Key Usages? #5091

johannww opened this issue Jan 2, 2025 · 0 comments

Comments

@johannww
Copy link
Contributor

johannww commented Jan 2, 2025

In practice, Fabric extendedKeyUsages are limited to ExtKeyUsageServerAuth (see references below). Is there a reason for that?

In the msp, the field x509.VerifyOptions.KeyUsages is never set:

msp.opts = &x509.VerifyOptions{Roots: x509.NewCertPool(), Intermediates: x509.NewCertPool()}

msp.opts = &x509.VerifyOptions{Roots: x509.NewCertPool(), Intermediates: x509.NewCertPool()}

Which means ExtKeyUsageServerAuth:

https://github.com/golang/go/blob/0afd7e85e5d7154161770f06a17d09bf1ffa3e94/src/crypto/x509/verify.go#L203-L206 states:

// KeyUsages specifies which Extended Key Usage values are acceptable. A
// chain is accepted if it allows any of the listed values. An empty list
// means ExtKeyUsageServerAuth. To accept any key usage, include ExtKeyUsageAny.
KeyUsages []ExtKeyUsage

In my case, the msp admin and peer had the following extended key usage:

        X509v3 extensions:
            X509v3 Extended Key Usage: 
                OCSP Signing

As a possible solution, the value could be set to x509.ExtKeyUsageAny.

@johannww johannww changed the title Why limit x509 extendedKeyUsages? Why limit x509 Extended Key Usages? Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant