Skip to content

Commit fc1dd7b

Browse files
authored
Merge pull request #468 from smallstep/mariano/aws-rsa384
Add missing signature algorithms for awskms
2 parents cfab90e + cc6a200 commit fc1dd7b

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

kms/awskms/awskms.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ var customerMasterKeySpecMapping = map[apiv1.SignatureAlgorithm]interface{}{
4646
3072: types.KeySpecRsa3072,
4747
4096: types.KeySpecRsa4096,
4848
},
49+
apiv1.SHA384WithRSA: map[int]types.KeySpec{
50+
0: types.KeySpecRsa3072,
51+
2048: types.KeySpecRsa2048,
52+
3072: types.KeySpecRsa3072,
53+
4096: types.KeySpecRsa4096,
54+
},
4955
apiv1.SHA512WithRSA: map[int]types.KeySpec{
5056
0: types.KeySpecRsa3072,
5157
2048: types.KeySpecRsa2048,
@@ -58,6 +64,12 @@ var customerMasterKeySpecMapping = map[apiv1.SignatureAlgorithm]interface{}{
5864
3072: types.KeySpecRsa3072,
5965
4096: types.KeySpecRsa4096,
6066
},
67+
apiv1.SHA384WithRSAPSS: map[int]types.KeySpec{
68+
0: types.KeySpecRsa3072,
69+
2048: types.KeySpecRsa2048,
70+
3072: types.KeySpecRsa3072,
71+
4096: types.KeySpecRsa4096,
72+
},
6173
apiv1.SHA512WithRSAPSS: map[int]types.KeySpec{
6274
0: types.KeySpecRsa3072,
6375
2048: types.KeySpecRsa2048,

kms/awskms/awskms_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ func Test_getCustomerMasterKeySpecMapping(t *testing.T) {
371371
{"SHA256WithRSA+2048", args{apiv1.SHA256WithRSA, 2048}, types.KeySpecRsa2048, assert.NoError},
372372
{"SHA256WithRSA+3072", args{apiv1.SHA256WithRSA, 3072}, types.KeySpecRsa3072, assert.NoError},
373373
{"SHA256WithRSA+4096", args{apiv1.SHA256WithRSA, 4096}, types.KeySpecRsa4096, assert.NoError},
374+
{"SHA384WithRSA", args{apiv1.SHA384WithRSA, 0}, types.KeySpecRsa3072, assert.NoError},
375+
{"SHA384WithRSA+2048", args{apiv1.SHA384WithRSA, 2048}, types.KeySpecRsa2048, assert.NoError},
376+
{"SHA384WithRSA+3072", args{apiv1.SHA384WithRSA, 3072}, types.KeySpecRsa3072, assert.NoError},
377+
{"SHA384WithRSA+4096", args{apiv1.SHA384WithRSA, 4096}, types.KeySpecRsa4096, assert.NoError},
374378
{"SHA512WithRSA", args{apiv1.SHA512WithRSA, 0}, types.KeySpecRsa3072, assert.NoError},
375379
{"SHA512WithRSA+2048", args{apiv1.SHA512WithRSA, 2048}, types.KeySpecRsa2048, assert.NoError},
376380
{"SHA512WithRSA+3072", args{apiv1.SHA512WithRSA, 3072}, types.KeySpecRsa3072, assert.NoError},
@@ -379,6 +383,10 @@ func Test_getCustomerMasterKeySpecMapping(t *testing.T) {
379383
{"SHA256WithRSAPSS+2048", args{apiv1.SHA256WithRSAPSS, 2048}, types.KeySpecRsa2048, assert.NoError},
380384
{"SHA256WithRSAPSS+3072", args{apiv1.SHA256WithRSAPSS, 3072}, types.KeySpecRsa3072, assert.NoError},
381385
{"SHA256WithRSAPSS+4096", args{apiv1.SHA256WithRSAPSS, 4096}, types.KeySpecRsa4096, assert.NoError},
386+
{"SHA384WithRSAPSS", args{apiv1.SHA384WithRSAPSS, 0}, types.KeySpecRsa3072, assert.NoError},
387+
{"SHA384WithRSAPSS+2048", args{apiv1.SHA384WithRSAPSS, 2048}, types.KeySpecRsa2048, assert.NoError},
388+
{"SHA384WithRSAPSS+3072", args{apiv1.SHA384WithRSAPSS, 3072}, types.KeySpecRsa3072, assert.NoError},
389+
{"SHA384WithRSAPSS+4096", args{apiv1.SHA384WithRSAPSS, 4096}, types.KeySpecRsa4096, assert.NoError},
382390
{"SHA512WithRSAPSS", args{apiv1.SHA512WithRSAPSS, 0}, types.KeySpecRsa3072, assert.NoError},
383391
{"SHA512WithRSAPSS+2048", args{apiv1.SHA512WithRSAPSS, 2048}, types.KeySpecRsa2048, assert.NoError},
384392
{"SHA512WithRSAPSS+3072", args{apiv1.SHA512WithRSAPSS, 3072}, types.KeySpecRsa3072, assert.NoError},

kms/mackms/mackms.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func (k *MacKMS) LoadCertificateChain(req *apiv1.LoadCertificateChainRequest) ([
402402

403403
cert, err := loadCertificate(u.label, u.serialNumber, nil)
404404
if err != nil {
405-
return nil, fmt.Errorf("mackms LoadCertificateChain failed1: %w", apiv1Error(err))
405+
return nil, fmt.Errorf("mackms LoadCertificateChain failed: %w", apiv1Error(err))
406406
}
407407

408408
chain := []*x509.Certificate{cert}
@@ -424,6 +424,7 @@ func (k *MacKMS) LoadCertificateChain(req *apiv1.LoadCertificateChainRequest) ([
424424
chain = append(chain, cert)
425425
}
426426

427+
//nolint:nilerr // return only the intermediates present in keychain
427428
return chain, nil
428429
}
429430

0 commit comments

Comments
 (0)