Encryption problem testshib.org

Brent Putman putmanb at georgetown.edu
Thu Nov 19 12:34:58 EST 2015



On 11/19/15 10:40 AM, Per Ahlbom wrote:
> I get this error when I try to use the sp.testshib.org
> <http://sp.testshib.org> environment when configuring the idp. I have
> implemented may own authentication mechanism.
>
> Caused by: org.apache.xml.security.encryption.XMLEncryptionException:
> Illegal key size
>         at
> org.apache.xml.security.encryption.XMLCipher.encryptData(XMLCipher.java:1186)
> Caused by: java.security.InvalidKeyException: Illegal key size
>         at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)

That error is related to not having the JCE unlimited strength policy
files installed in the JRE under which your IdP is running.  You can
download for Oracle Java 7 [1] and 8 [2].

Underlying reason: Looks like it's trying to use an AES 256-bit key for
the bulk data encryption.  I wasn't consciously aware of this, but
that's actually what the TestShib SP's metadata [3] says to do. IdP 3.x
will use signing and encryption algorithm preferences stated in the
SP's metadata if present. The TestShib SP's KeyDescriptor indicates the
encryption methods in this order:

<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes192-cbc"/>
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
<EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
<EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>



That's probably from an older config recommendation.  I believe the
thinking has changed on best-practice for AES key sizes, and now it's
thought that AES-128 is best as a default, since 256 and 192 don't
really provide any more security, and they're more expensive.   For
example, a modern Shib SP's metadata generator generates this by default:

<md:EncryptionMethod
Algorithm="http://www.w3.org/2009/xmlenc11#aes128-gcm"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2009/xmlenc11#aes192-gcm"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2009/xmlenc11#aes256-gcm"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#aes192-cbc"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<md:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#rsa-oaep"/>
<md:EncryptionMethod
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>


I suppose we should consider updating TestShib's metadata to be in line
with these newer recommendations.

--Brent



[1]
http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html
[2]
http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html
[3] https://www.testshib.org/metadata/testshib-providers.xml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20151119/5bd5d14c/attachment.html>


More information about the users mailing list