-
Notifications
You must be signed in to change notification settings - Fork 29
feat: delta CRL #247
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
Merged
Merged
feat: delta CRL #247
Changes from 4 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
e34370f
feat: delta CRL
JeyJeyGao 8182be9
fix: license and variable names
JeyJeyGao 2049193
fix: optimize logic
JeyJeyGao 33d5590
fix: working on delta CRL
JeyJeyGao 7984f57
fix: bug
JeyJeyGao 77b5972
test: add test for fetcher
JeyJeyGao 0b6179a
test: complete test for validate
JeyJeyGao c9f936f
test: add test cases
JeyJeyGao c228487
Merge branch 'main' into feat/delta_crl
JeyJeyGao 483d298
fix: only support delta CRL url from base CRL
JeyJeyGao 2910e31
fix: update
JeyJeyGao 934698a
fix: improve code style
JeyJeyGao c506b40
Merge branch 'main' into feat/delta_crl
JeyJeyGao cc34d0d
fix: update
JeyJeyGao 630c7a5
fix: simplify code
JeyJeyGao ad51cf8
fix: simplify code
JeyJeyGao a9330e5
fix: update
JeyJeyGao b2f2852
fix: optimize Fetch
JeyJeyGao 1239c5c
fix: update
JeyJeyGao 28069ee
fix: resolve comment for Shiwei
JeyJeyGao 6becbe1
fix: update
JeyJeyGao 43e6407
fix: resolve comments for Two-Hearts
JeyJeyGao 52c48a8
fix: add license
JeyJeyGao 0e5b4d0
fix: simplify code
JeyJeyGao dc3a62e
fix: test
JeyJeyGao 9c5f919
fix: resolve comment for Shiwei
JeyJeyGao a24fe9d
fix: update comment
JeyJeyGao 31bdd6a
Merge branch 'main' into feat/delta_crl
JeyJeyGao 3de709f
Merge branch 'main' into feat/delta_crl
JeyJeyGao e49e0de
Merge branch 'main' into feat/delta_crl
JeyJeyGao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright The Notary Project Authors. | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package x509util | ||
|
|
||
| import ( | ||
| "crypto/x509/pkix" | ||
| "encoding/asn1" | ||
| "slices" | ||
| ) | ||
|
|
||
| // FindExtensionByOID finds the extension by the given OID. | ||
| func FindExtensionByOID(oid asn1.ObjectIdentifier, extensions []pkix.Extension) *pkix.Extension { | ||
JeyJeyGao marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| idx := slices.IndexFunc(extensions, func(ext pkix.Extension) bool { | ||
| return ext.Id.Equal(oid) | ||
| }) | ||
| if idx < 0 { | ||
| return nil | ||
| } | ||
| return &extensions[idx] | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| // Copyright The Notary Project Authors. | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
|
|
||
| package x509util | ||
|
|
||
| import ( | ||
| "crypto/x509/pkix" | ||
| "encoding/asn1" | ||
| "testing" | ||
| ) | ||
|
|
||
| func TestFindExtensionByOID(t *testing.T) { | ||
| oid1 := asn1.ObjectIdentifier{1, 2, 3, 4} | ||
| oid2 := asn1.ObjectIdentifier{1, 2, 3, 5} | ||
| extensions := []pkix.Extension{ | ||
| {Id: oid1, Value: []byte("value1")}, | ||
| {Id: oid2, Value: []byte("value2")}, | ||
| } | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| oid asn1.ObjectIdentifier | ||
| extensions []pkix.Extension | ||
| expected *pkix.Extension | ||
| }{ | ||
| { | ||
| name: "Extension found", | ||
| oid: oid1, | ||
| extensions: extensions, | ||
| expected: &extensions[0], | ||
| }, | ||
| { | ||
| name: "Extension not found", | ||
| oid: asn1.ObjectIdentifier{1, 2, 3, 6}, | ||
| extensions: extensions, | ||
| expected: nil, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| result := FindExtensionByOID(tt.oid, tt.extensions) | ||
| if result != tt.expected { | ||
| t.Errorf("expected %v, got %v", tt.expected, result) | ||
| } | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.