Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rekor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SafSec
rekor
Commits
42aa2b04
Unverified
Commit
42aa2b04
authored
3 years ago
by
asraa
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use email from SAN (#288)
Signed-off-by:
Asra Ali
<
asraa@google.com
>
parent
5d11711e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pkg/pki/x509/x509.go
+7
-3
7 additions, 3 deletions
pkg/pki/x509/x509.go
tests/x509.go
+18
-15
18 additions, 15 deletions
tests/x509.go
with
25 additions
and
18 deletions
pkg/pki/x509/x509.go
+
7
−
3
View file @
42aa2b04
...
@@ -30,6 +30,8 @@ import (
...
@@ -30,6 +30,8 @@ import (
"io"
"io"
"io/ioutil"
"io/ioutil"
"strings"
"strings"
"github.com/go-playground/validator"
)
)
// EmailAddressOID defined by https://oidref.com/1.2.840.113549.1.9.1
// EmailAddressOID defined by https://oidref.com/1.2.840.113549.1.9.1
...
@@ -176,9 +178,11 @@ func (k PublicKey) CanonicalValue() ([]byte, error) {
...
@@ -176,9 +178,11 @@ func (k PublicKey) CanonicalValue() ([]byte, error) {
func
(
k
PublicKey
)
EmailAddresses
()
[]
string
{
func
(
k
PublicKey
)
EmailAddresses
()
[]
string
{
var
names
[]
string
var
names
[]
string
if
k
.
cert
!=
nil
{
if
k
.
cert
!=
nil
{
for
_
,
name
:=
range
k
.
cert
.
c
.
Subject
.
Names
{
for
_
,
name
:=
range
k
.
cert
.
c
.
EmailAddresses
{
if
name
.
Type
.
Equal
(
EmailAddressOID
)
{
validate
:=
validator
.
New
()
names
=
append
(
names
,
strings
.
ToLower
(
name
.
Value
.
(
string
)))
errs
:=
validate
.
Var
(
name
,
"required,email"
)
if
errs
==
nil
{
names
=
append
(
names
,
strings
.
ToLower
(
name
))
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/x509.go
+
18
−
15
View file @
42aa2b04
...
@@ -47,21 +47,24 @@ baT2ax2dXBcpInWaFESqGF35KISflP1EmMvEnfG+AzHecQ0WQp5QzNId+w==
...
@@ -47,21 +47,24 @@ baT2ax2dXBcpInWaFESqGF35KISflP1EmMvEnfG+AzHecQ0WQp5QzNId+w==
// Generated with:
// Generated with:
// openssl req -newkey rsa:2048 -nodes -keyout test.key -x509 -out test.crt
// openssl req -newkey rsa:2048 -nodes -keyout test.key -x509 -out test.crt
const
rsaCert
=
`-----BEGIN CERTIFICATE-----
const
rsaCert
=
`-----BEGIN CERTIFICATE-----
MIICujCCAaICCQDV0chJ/QVmCTANBgkqhkiG9w0BAQsFADAfMR0wGwYJKoZIhvcN
MIIDOjCCAiKgAwIBAgIUEP925shVBKERFCsymdSqESLZFyMwDQYJKoZIhvcNAQEL
AQkBFg50ZXN0QHJla29yLmRldjAeFw0yMTAyMjAxOTUyMTZaFw0yMTAzMjIxOTUy
BQAwHzEdMBsGCSqGSIb3DQEJARYOdGVzdEByZWtvci5kZXYwHhcNMjEwNDIxMjAy
MTZaMB8xHTAbBgkqhkiG9w0BCQEWDnRlc3RAcmVrb3IuZGV2MIIBIjANBgkqhkiG
ODAzWhcNMjEwNTIxMjAyODAzWjAfMR0wGwYJKoZIhvcNAQkBFg50ZXN0QHJla29y
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3wqI/TysUiKTgY1bz+wdJfEOil4ME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wDQYJKoZIhvcNAQELBQADggEBAAHE
40Erllt4ra2N0CkIaYei0ZfuMRkoav3jc+2OcbCzQzTDq7HIxfSirz9up6+hjn+G
bYuePN3XpM7pHoCz6g4uTHu0VrezqJyK1ohysgWJmSJzzazUeISXk0xWnHPk1Zxi
GZXHemYIVbviNo9qr5cVY4OCJJQIUmGOcp+F4sNIqjbeEkTWFkeAy7sPSU8c8WQX
kzoEuysI8b0P7yodMA8e16zbIOL6QbGe3lNXYqRIg+bl+4OPFGVMX8xHNZmeh0kD
l7ArJO7hmz6eJON+xDbhcYtAOavUqbT+fVcgi2qm
vX1JVS+y9uyo4/z/pm0JhaSCn85ft/Y5uXMQYn1wFR5DAcJH+iWjNX4fipGxGRE9
Cy0DjFnYJ3SRY4HPQ0oUSQmyhrwe2DiYzeqtbL2KJBXPcFQKWhkf/fupdYFljvcH
d9NNfRb0p2oFGG/J0ROg9pEcP1/aZP5k8P2pRdt3y7h1MAtmg2bgEdugZgXwAUmM
BmU8k2FeTuqV15piPCE=
-----END CERTIFICATE-----`
-----END CERTIFICATE-----`
const
rsaKey
=
`-----BEGIN PRIVATE KEY-----
const
rsaKey
=
`-----BEGIN PRIVATE KEY-----
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment