Support for SHA256?
Lukas Österreicher
lukas.oesterreicher at inode.at
Wed Jun 5 13:40:26 EDT 2013
> On 6/5/13 12:19 PM, "Lukas Österreicher" <lukas.oesterreicher at inode.at>
> wrote:
>>
>>I was wondering if opensaml can support signatures with SHA256withRSA
>>instead of SHA1withRSA.
> XML for sure, but you're asking about SAML redirects.
>>I took a look at the detection of the SigAlg URL in
>>BasicSecurityConfiguration
>>(using getSignatureAlgorithmURI which in turn is called (at least in
>>my case) HTTPRedirectDeflateEncoder.getSignatureAlgorithmURI) and it
>>appears the detection is just based on the Algorithm of the Key
>>wich is just "RSA" in the typical case.
>>So it would not even allow distinguishing between hash algorithms.
> Could be that's a bug, I'd suggest filing it in jira and Brent or I will
> take a look.
>>On the other hand, when I just went ahead and used a SHA256withRSA
>>Signature my unit tests (covering SAML login and logout) ran through
>>correctly.
>>Was SHA256 actually used and just the SigAlg paramter is incorrect?
> If the SigAlg says SHA1, then the verifier definitely should use SHA1. So
> it's possible it's broken. I'm sure that whatever it used was the same on
> both ends if it passed the test. I'm not worried it's mis-verifying, but
> it may not be handling the algorithm correctly on input.
> (Or you're just mistaken about something, but I'm giving the benefit of
> the doubt.)
> -- Scott
Thanx for your response.
I'm not an expert on crypto details but this is what I know:
- The certificate (and pkcs12 derived from it and the key) are based
on SHA256 and that also shows up when I debug in to the loaded cert.
I used these commands to generate:
openssl req -x509 -sha256 -nodes -days 1826 -newkey rsa:2048 -keyout saml.key -out saml.cert
openssl pkcs12 -export -out saml.pkcs12 -inkey saml.key -in saml.cert -name "real saml pkcs12 private key"
- The class previously mentioned seemes ill equipped to handle more
than SHA1. All algorithms mentioned in the map containing SigAlgs are
specific to SHA1
- Signing and verification of the signature is based on those files
and runs through correctly. This is the case for both XML based
signatures in the login POST body containing the login response as
well as the query string based signature used in the logout (both on
the logout request as well as the logout response).
- The signature algorithm stated in both the XML of the login POST
body and the SigAlg paramter for logout request and response are
"http://www.w3.org/2000/09/xmldsig#rsa-sha1"
I am not sure however if it is even possible to sign with SHA1 hashes
if the signature and private key are SHA256.
Maybe you know?
I assume it is not possible meaning that the provided SigAlg may be
different than the one actually used in the verification.
If it is possible however then it may mean that SHA1 is always used no
matter what.
I'll do some further debugging to see if I can find out more.
I'll also see to it to raise a Bug since SHA256 should be supported.
Maybe you can give me further hints on how to find out what's actually
happening and what I can do from my side (try out work-arounds or
provide you more data)?
Thanx!
Lukas
More information about the dev
mailing list