Skip to content

Commit 0928dfd

Browse files
authored
Merge pull request #7 from anovik/rsa-pss
[US-1069] RSA-PSS support
2 parents 9bc0dee + ec99e9c commit 0928dfd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkcs7.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ var (
6969
// Signature Algorithms
7070
OIDEncryptionAlgorithmRSA = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1}
7171
OIDEncryptionAlgorithmRSASHA1 = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 5}
72+
OIDEncryptionAlgorithmRSAPSS = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 10}
7273
OIDEncryptionAlgorithmRSASHA256 = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11}
7374
OIDEncryptionAlgorithmRSASHA384 = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 12}
7475
OIDEncryptionAlgorithmRSASHA512 = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 13}

verify.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,18 @@ func getSignatureAlgorithm(digestEncryption, digest pkix.AlgorithmIdentifier) (x
292292
return -1, fmt.Errorf("pkcs7: unsupported digest %q for encryption algorithm %q",
293293
digest.Algorithm.String(), digestEncryption.Algorithm.String())
294294
}
295+
case digestEncryption.Algorithm.Equal(OIDEncryptionAlgorithmRSAPSS):
296+
switch {
297+
case digest.Algorithm.Equal(OIDDigestAlgorithmSHA256):
298+
return x509.SHA256WithRSAPSS, nil
299+
case digest.Algorithm.Equal(OIDDigestAlgorithmSHA384):
300+
return x509.SHA384WithRSAPSS, nil
301+
case digest.Algorithm.Equal(OIDDigestAlgorithmSHA512):
302+
return x509.SHA512WithRSAPSS, nil
303+
default:
304+
return -1, fmt.Errorf("pkcs7: unsupported digest %q for encryption algorithm %q",
305+
digest.Algorithm.String(), digestEncryption.Algorithm.String())
306+
}
295307
case digestEncryption.Algorithm.Equal(OIDDigestAlgorithmDSA),
296308
digestEncryption.Algorithm.Equal(OIDDigestAlgorithmDSASHA1):
297309
switch {

0 commit comments

Comments
 (0)