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

Populate the server's CertRep with CA certificates before verifying #131

Merged
merged 3 commits into from
Feb 18, 2021

Conversation

omorsi
Copy link
Contributor

@omorsi omorsi commented Feb 18, 2021

This PR is to solve issue #122.

Copying the issue description here to save readers' time.

The following is stated in RFC: PKCS #7: Cryptographic Message Syntax Version 1.5: SignedData type.

certificates is a set of PKCS #6 extended certificates and X.509 certificates. It is intended that the set be sufficient to contain chains from a recognized "root" or "top-level certification authority" to all of the signers in the signerInfos field. There may be more certificates than necessary, and there may be certificates sufficient to contain chains from two or more independent top-level certification authorities. There may also be fewer certificates than necessary, if it is expected that those verifying the signatures have an alternate means of obtaining necessary certificates (e.g., from a previous set of certificates).

IIUC, this means that in SCEP context, it is valid that as a response to PKCSReq message, a SCEP server returns a PKIMessage without adding the CA certificate because there is an alternate means of obtaining necessary certirficates, which is using GetCaCert in this case.

If a SCEP server acted in this valid way, PKCS7 verification will fail in

if err := p7.Verify(); err != nil {

The proposal here is not to remove verification, but to populate the certificates field with the CA certificate obtained by the GetCaCert call before verification.

@omorsi
Copy link
Contributor Author

omorsi commented Feb 18, 2021

@pavolmarko FYI!

Copy link
Member

@groob groob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nits, but LGTM overall.

scep/scep.go Outdated Show resolved Hide resolved
scep/scep.go Outdated Show resolved Hide resolved
scep/scep.go Outdated Show resolved Hide resolved
scep/scep_test.go Outdated Show resolved Hide resolved
scep/scep_test.go Outdated Show resolved Hide resolved
scep/scep.go Outdated Show resolved Hide resolved
@groob groob merged commit 20d9e05 into micromdm:master Feb 18, 2021
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

Successfully merging this pull request may close these issues.

2 participants