Skip to Content.
Sympa Menu

mace-opensaml-users - Base64DecodingException: Illegal byte length; Data to be decoded must be a multiple of 4

Subject: OpenSAML user discussion

List archive

Base64DecodingException: Illegal byte length; Data to be decoded must be a multiple of 4


Chronological Thread 
  • From: "Shobha Rani Jagathpal" <>
  • To: <>
  • Subject: Base64DecodingException: Illegal byte length; Data to be decoded must be a multiple of 4
  • Date: Mon, 3 Feb 2003 12:31:42 +0530

Title: Message
Hi,
 
    I have problem in post the SAML response(Browser/Post profile) as base64 encoded format
 
    These are the steps I followed. Please let me know where am I going wrong.
   
    1. used toBase64() of SAMLResponse to get byte[]. Printing its length which is 1795
 
    2. used StringBuffer to get string value of it, printing its length which is 4130. Then post it with a jsp(onload) to another servlet (different tomcat)
            String sb64 = new String();  
            StringBuffer stb64 = new StringBuffer();
              for(int i=0 ; i < sbase64encoded.length ; i++)
              {
                   stb64.append(sbase64encoded[i]);
              }
             sb64= stb64.toString();
    3.  I get the saml response object in that servlet by req.getParameter("SAMLResponse");
         Printing the Length of this string which is 4130
 
    4. I use getBytes() to get byte[]
        printing its length which is again 4130
 
  5.   Now I am sure that there is some thing wrong . After that when I pass this byte[] to accept method of SAMLResponse , it get an exception as follows
 
org.apache.xml.security.exceptions.Base64DecodingException: Illegal byte length; Data to be decoded must be a multiple of 4
Original Exception was java.lang.StringIndexOutOfBoundsException: String index out of range: 4130
        at org.opensaml.SAMLPOSTProfile.accept(SAMLPOSTProfile.java:199)
        at DestinationSiteServlet.doPost(DestinationSiteServlet.java:41)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
        at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
        at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
        at java.lang.Thread.run(Thread.java:536)
 
Please let me know if anybody find some thing wrong.
 
Best Regards,
Shobha Rani J
 
BEGIN:VCARD
VERSION:2.1
N:Jagathpal;Shobha Rani
FN:Shobha Rani Jagathpal
ORG:Wipro Technologies
TITLE:Project Engineer
TEL;HOME;VOICE:6391946
EMAIL;PREF;INTERNET:
REV:20030123T045535Z
END:VCARD
**************************Disclaimer**************************************************


Information contained in this E-MAIL being proprietary to Wipro Limited is
'privileged'
and 'confidential' and intended for use only by the individual or entity to
which it is
addressed. You are notified that any use, copying or dissemination of the
information
contained in the E-MAIL in any manner whatsoever is strictly prohibited.

****************************************************************************************






Archive powered by MHonArc 2.6.16.

Top of Page