<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <br>
    <div class="moz-cite-prefix">On 11/19/15 10:40 AM, Per Ahlbom wrote:<br>
    </div>
    <blockquote
cite="mid:CAK2136_e6ey7Pg4Vk5yO_nV2SfERnOn7PSPrV+Zx7oXXCurj6g@mail.gmail.com"
      type="cite">
      <div dir="ltr">I get this error when I try to use the <a
          moz-do-not-send="true" href="http://sp.testshib.org">sp.testshib.org</a>
        environment when configuring the idp. I have implemented may own
        authentication mechanism. <br>
        <br>
        Caused by:
        org.apache.xml.security.encryption.XMLEncryptionException:
        Illegal key size<br>
                at
org.apache.xml.security.encryption.XMLCipher.encryptData(XMLCipher.java:1186)<br>
        Caused by: java.security.InvalidKeyException: Illegal key size<br>
                at javax.crypto.Cipher.checkCryptoPerm(Cipher.java:1039)<br>
      </div>
    </blockquote>
    <br>
    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].<br>
    <br>
    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:<br>
    <tt><br>
    </tt><tt><EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#aes256-cbc">"http://www.w3.org/2001/04/xmlenc#aes256-cbc"</a>/></tt><tt><br>
    </tt><tt><EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#aes192-cbc">"http://www.w3.org/2001/04/xmlenc#aes192-cbc"</a>/></tt><tt><br>
    </tt><tt><EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#aes128-cbc">"http://www.w3.org/2001/04/xmlenc#aes128-cbc"</a>/></tt><tt><br>
    </tt><tt><EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">"http://www.w3.org/2001/04/xmlenc#tripledes-cbc"</a>/></tt><tt><br>
    </tt><tt><EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"</a>/></tt><tt><br>
    </tt><tt><EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#rsa-1_5">"http://www.w3.org/2001/04/xmlenc#rsa-1_5"</a>/><br>
      <br>
      <br>
      <br>
    </tt>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:<br>
    <br>
    <tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2009/xmlenc11#aes128-gcm">"http://www.w3.org/2009/xmlenc11#aes128-gcm"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2009/xmlenc11#aes192-gcm">"http://www.w3.org/2009/xmlenc11#aes192-gcm"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2009/xmlenc11#aes256-gcm">"http://www.w3.org/2009/xmlenc11#aes256-gcm"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#aes128-cbc">"http://www.w3.org/2001/04/xmlenc#aes128-cbc"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#aes192-cbc">"http://www.w3.org/2001/04/xmlenc#aes192-cbc"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#aes256-cbc">"http://www.w3.org/2001/04/xmlenc#aes256-cbc"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#tripledes-cbc">"http://www.w3.org/2001/04/xmlenc#tripledes-cbc"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2009/xmlenc11#rsa-oaep">"http://www.w3.org/2009/xmlenc11#rsa-oaep"</a>/></tt><tt><br>
    </tt><tt><md:EncryptionMethod
      Algorithm=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p">"http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"</a>/></tt><br>
    <br>
    <br>
    I suppose we should consider updating TestShib's metadata to be in
    line with these newer recommendations.<br>
    <br>
    --Brent<br>
    <tt><br>
      <br>
      <br>
    </tt>[1]
<a class="moz-txt-link-freetext" href="http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html">http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html</a><br>
    [2]
<a class="moz-txt-link-freetext" href="http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html">http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html</a><br>
    [3] <a class="moz-txt-link-freetext" href="https://www.testshib.org/metadata/testshib-providers.xml">https://www.testshib.org/metadata/testshib-providers.xml</a>
  </body>
</html>