Skip to content

Added conversion of DER to PEM for verify#235

Closed
patrickzheng200 wants to merge 2 commits intonotaryproject:mainfrom
patrickzheng200:DER
Closed

Added conversion of DER to PEM for verify#235
patrickzheng200 wants to merge 2 commits intonotaryproject:mainfrom
patrickzheng200:DER

Conversation

@patrickzheng200
Copy link
Copy Markdown
Contributor

Signed-off-by: Patrick Zheng patrickzheng@microsoft.com

Resolves #157

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
}
if !verifier.VerifyOptions.Roots.AppendCertsFromPEM(data) {
return nil, fmt.Errorf("failed to parse PEM certificate: %q", path)
certPEM := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: data})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably we can add a comment to explain that we're trying to convert DER to PEM? But it looks good to me overall.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probably we can add a comment to explain that we're trying to convert DER to PEM? But it looks good to me overall.

Sure. Will add a comment to it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did you test it with some corner cases? like empty file, wrong cert file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Did you test it with some corner cases? like empty file, wrong cert file.

Yes, both scenarios are covered. Also tested end to end with the example net-monitor image.

Signed-off-by: Patrick Zheng <patrickzheng@microsoft.com>
Copy link
Copy Markdown
Contributor

@SteveLasker SteveLasker left a comment

Choose a reason for hiding this comment

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

Thanks @patrickzheng200, this really helps cleanup the usability of #157
LGTM

@SteveLasker
Copy link
Copy Markdown
Contributor

SteveLasker commented Jul 19, 2022

@patrickzheng200, was this accidentally closed, vs. merged?

@patrickzheng200
Copy link
Copy Markdown
Contributor Author

patrickzheng200 commented Jul 20, 2022

@patrickzheng200, was this accidentally closed, vs. merged?

I noticed that pkg/signature/jws.go file has been removed from notation due to this PR , so I closed this one. The original issue has also been closed as DER format certificate can be added to the new trust store.

@patrickzheng200
Copy link
Copy Markdown
Contributor Author

We are supporting notation verify with binary encoded DER in notation-core-go.

@patrickzheng200 patrickzheng200 deleted the DER branch September 26, 2022 03:42
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.

add support for binary-encoded x509 certs

4 participants