-
Notifications
You must be signed in to change notification settings - Fork 44
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
Trying to use RSASSA_PKCS1_V1_5_WITH_SHA3_256 signing alg results in IllegalArgumentException: Unknown signature type requested: RSASSAPSS #143
Comments
Yes you are right. |
I think the If you need a different algorithm, just let me know |
Well, I am looking to sign using SHA256 with RSASSA-PSS I believe the BC equivalent of the spec I'm looking at to be SHA256withRSAandMGF1 but the label of RSASSA_PKCS1_V1_5_WITH_SHA3_256 does point to SHA3-256WITHRSA as I think RSASSA PKCS1 1.5 shouldn't use RSAPSS. |
Am I assuming correctly, that it is about the edi@energy requirements described in https://www.psw-group.de/blog/rsassa-pss-was-sie-ueber-den-signaturalgorithmus-wissen-muessen/6749 ??? AS2 That OID is mapped to the BC algorithms Can you easily make a locally patched version and try out if it works? Or shall I create a new version adding this enum entry and you try it then? |
Yes, it's about edi@energry, the RSASSA_PKCS1_V1_5_WITH_SHA3_256 should refer to "SHA3-256WITHRSA" (BC) but the described SHA256 with RSASSA-PSS that I need would refer to "SHA256withRSAandMGF1" in BC if I'm not mistaken and could be added under RSASSA_PSS_WITH_SHA256. I'm working on creating locally patched version to test this. |
I made changes over at my local clone but I'm waiting for the opportunity to test them. This should work both with SunRsaSign and BC and be equivalent but under correct enum labeling. |
I ended up running into next error:
Probably by my choice of PKCSObjectIdentifiers.id_RSASSA_PSS for ASN1ObjectIdentifier aOID in ECryptoAlgorithmSign enum, but I'm struggling to figure out correct values to use. |
@phax This setup does result in expected test failures:
But doesn't that suggest that mic algo should be decoupled from sign algo? Or am I getting all this structures wrong? Using entry
I was able to establish communication with partner but naturally it required hacking away "sha-256" definition. |
Statement from RFC 4130, chapter 7.4.3:
The definition of "Use of the RSASSA-PSS Signature Algorithm in Cryptographic Message Syntax (CMS)" can be found in https://www.rfc-editor.org/rfc/rfc4056 Technically it seems to be
So if you give your entry in the enum a separate ID, it should be okay: RSASSA_PSS_WITH_SHA256 ("sha-256-with-rsa-and-mgf1",
NISTObjectIdentifiers.id_rsassa_pkcs1_v1_5_with_sha3_256,
"SHA256WITHRSAANDMGF1"); As the algorithm is not officially supported by AS2 you are outside the spec anyway - a decision edi@energy choose on purpose I guess.... |
But signing with RSASSA-PSS with SHA256 consist of message digest with SHA256, then RSASSA-PSS signature, if we still had NONEWITHRSASSA-PSS we could separate it into two steps:
BC, SUN, SunRsaSign, SunEC, SunJSSE, SunJCE, SunJGSS, SunSASL, XMLDSig, SunPCSC, JdkLDAP, JdkSASL, SunPKCS11 crypto providers don't recognize id_rsassa_pkcs1_v1_5_with_sha3_256, or any rsassa-pss identifier as valid digestion algorithm. Cosnidering that MIC is calcuated using MessageDigest wouldn't that mean it's correct to use configurations like:
Those seems to work with our test environment configured to accept RSASSA-PSS signatures and we don't see any complaints about MIC mismatch. |
@michaldaniel Thanks, I implemented the 2 algorithms for the upcoming 5.0.0 release |
@michaldaniel you were totally right with your analysed - I kicked the /**
* RSASSA-PSS with digest algorithm SHA224.
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA224 ("rsassa-pss-sha-224", "sha-224", NISTObjectIdentifiers.id_sha224, "SHA224WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA256
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA256 ("rsassa-pss-sha-256", "sha-256", NISTObjectIdentifiers.id_sha256, "SHA256WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA384
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA384 ("rsassa-pss-sha-384", "sha-384", NISTObjectIdentifiers.id_sha384, "SHA384WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA512
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA512 ("rsassa-pss-sha-512", "sha-512", NISTObjectIdentifiers.id_sha512, "SHA512WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA3-224
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA3_224 ("rsassa-pss-sha3-224",
"sha3-224",
NISTObjectIdentifiers.id_sha3_224,
"SHA3-224WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA3-256
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA3_256 ("rsassa-pss-sha3-256",
"sha3-256",
NISTObjectIdentifiers.id_sha3_256,
"SHA3-256WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA3-384
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA3_384 ("rsassa-pss-sha3-384",
"sha3-384",
NISTObjectIdentifiers.id_sha3_384,
"SHA3-384WITHRSAANDMGF1"),
/**
* RSASSA-PSS with digest algorithm SHA3-512
*
* @since 5.0.0
*/
RSASSA_PSS_WITH_SHA3_512 ("rsassa-pss-sha3-512",
"sha3-512",
NISTObjectIdentifiers.id_sha3_512,
"SHA3-512WITHRSAANDMGF1") |
This is part of the v5.0.0 release. Closing this for now |
Hi,
when sending message out that uses RSASSA_PKCS1_V1_5_WITH_SHA3_256 signing algorithm configured in ECryptoAlgorithmSign:
I get an error from bouncycastle DefaultSignatureAlgorithmIdentifierFinder:
Looking at sources of bouncycastle DefaultSignatureAlgorithmIdentifierFinder there is no "RSASSAPSS" algorithm definition.
The text was updated successfully, but these errors were encountered: