-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* AUT-291 - expanding makecsr options to have more flexibility This was mainly to hat we need to be able to adjust for some hard coded firefox checks: https://searchfox.org/mozilla-central/rev/7d1b5c88343879056168aa710a9ee743392604c0/taskcluster/kinds/repackage-msix/kind.yml#104 .
- Loading branch information
1 parent
be80e97
commit 72a535d
Showing
3 changed files
with
37 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -18,24 +18,28 @@ import ( | |
func TestGoldenPath(t *testing.T) { | ||
testcases := []struct { | ||
privKey crypto.PrivateKey | ||
org string | ||
orgUnit string | ||
commonName string | ||
country string | ||
state string | ||
locale string | ||
email string | ||
dnsNames []string | ||
sigAlg x509.SignatureAlgorithm | ||
expectedError error | ||
}{ | ||
{generateRSAKey(t), "MozOrg", "MozCN", "", []string{"example.com", "biff.com"}, x509.SHA256WithRSA, nil}, | ||
{generateRSAKey(t), "MozOrg", "MozCN", "", []string{"okay.com"}, x509.SHA384WithRSA, nil}, | ||
{generateRSAKey(t), "MozOrg", "MozCN/email=foobar.com", "", []string{"okay.com"}, x509.SHA256WithRSA, nil}, | ||
{generateRSAKey(t), "MozOrg", "MozCN", "[email protected]", []string{"okay.com"}, x509.SHA256WithRSA, nil}, | ||
{generateECDSAKey(t), "Foo", "foocN", "", []string{"okay.com"}, x509.ECDSAWithSHA256, nil}, | ||
{generateECDSAKey(t), "Foo", "foocN", "", []string{"okay.com"}, x509.ECDSAWithSHA384, nil}, | ||
{generateRSAKey(t), "MozOrg", "MozCN", "", []string{"failed.com"}, x509.ECDSAWithSHA256, errors.New("x509: requested SignatureAlgorithm does not match private key type")}, | ||
{generateRSAKey(t), "Mozilla", "MozOrg", "MozCN", "US", "California", "San Francisoco", "", []string{"example.com", "biff.com"}, x509.SHA256WithRSA, nil}, | ||
{generateRSAKey(t), "Mozilla Corp", "MozOrg", "MozCN", "US", "California", "San Francisoco", "", []string{"okay.com"}, x509.SHA384WithRSA, nil}, | ||
{generateRSAKey(t), "Mozilla Corporation", "MozOrg", "MozCN/email=foobar.com", "US", "California", "San Francisoco", "", []string{"okay.com"}, x509.SHA256WithRSA, nil}, | ||
{generateRSAKey(t), "Mozilla Corporation", "MozOrg", "MozCN", "US", "California", "San Francisoco", "[email protected]", []string{"okay.com"}, x509.SHA256WithRSA, nil}, | ||
{generateECDSAKey(t), "Mozilla Corporation", "Foo", "foocN", "US", "California", "San Francisoco", "", []string{"okay.com"}, x509.ECDSAWithSHA256, nil}, | ||
{generateECDSAKey(t), "Mozilla Corporation", "Foo", "foocN", "US", "California", "San Francisoco", "", []string{"okay.com"}, x509.ECDSAWithSHA384, nil}, | ||
{generateRSAKey(t), "Mozilla Corporation", "MozOrg", "MozCN", "US", "California", "San Francisoco", "", []string{"failed.com"}, x509.ECDSAWithSHA256, errors.New("x509: requested SignatureAlgorithm does not match private key type")}, | ||
} | ||
for i, tc := range testcases { | ||
t.Run(strconv.Itoa(i), func(t *testing.T) { | ||
out, err := generatePEMEncodedCSR(tc.privKey, tc.orgUnit, tc.commonName, tc.email, tc.dnsNames, tc.sigAlg) | ||
out, err := generatePEMEncodedCSR(tc.privKey, tc.org, tc.orgUnit, tc.commonName, tc.country, tc.state, tc.locale, tc.email, tc.dnsNames, tc.sigAlg) | ||
if tc.expectedError != nil { | ||
if err == nil { | ||
t.Fatalf("expectedError: want %v, got nil", tc.expectedError) | ||
|