OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

saml-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Deflate compression again

Hi all,

The thread at 
already discussed how to use the Java java.util.zip.Deflater in order to 
a SAML protocol message for use with the HTTP Redirect Binding.

It was pointed to the need to set the "nowrap" argument of the the 
Deflater constructor
to "true" in order to produce the correct output (RFC1951, without zlib 

We succeed in encoding and decoding data without the headers using the 
Deflater and
Inflater classes.

What doesn't work however is decoding in this way the SAMLRequest 
parameter that is presented
as an example of the Redirect Binding in the SAML2 Bindings document.

Are we missing something or is this example not encoded correctly? If 
the latter is the case, could someone
supply a correctly encoded SAMLRequest for testing purposes?

We  try to decompress the parameter with the following code, it fails with
"Exception in thread "main" java.util.zip.DataFormatException: invalid 
bit length repeat
    at java.util.zip.Inflater.inflateBytes(Native Method)..."

        // Example of an HTTP-Redirect encoded LogoutRequest message 
from SAML2 Bindings Spec (p.21)
        System.out.println("Url Encoded SAMLRequest: " + 
samlRequestUrlEncoded + "\n");

        String urlDecoded = URLDecoder.decode(samlRequestUrlEncoded, 
        System.out.println("URL-decoded: " + urlDecoded + "\n");
        byte compressedBytes[] = new 

        // nowrap=true
        Inflater decompresser = new Inflater(true);
        byte[] result = new byte[2000];
        int resultLength = decompresser.inflate(result);

        // Decode the bytes into a String
        String outputString = new String(result, 0, resultLength, "UTF-8");
        System.out.println("inflater output: " + outputString);

Thanks for your help,

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]