List Info

Thread: X509 XmlValueOutOfRangeException




X509 XmlValueOutOfRangeException
user name
2006-01-18 18:07:52
Hi Alistair

Without seeing the cert it's difficult to tell.

According to the schema the X509CertificateArray type within
X509DataType is of type base64Binary. So your error is
coming from org.apache.xmlbeans.impl.values.JavaBase64Holder
in the public method lex() at line 77. I apologise that the
error message is not very helpful - there's even a note in
the code right there to say we should update it when we get
time.

But the reason you're getting this is that it is unable to
decode the String that's being passed in.
JavaBase64Holder.lex() simply converts the String to UTF-8
bytes and then passes those bytes into Base64.decode() which
must be returning null for you to see this error.

Base64.decode() is a public static method. So if I were you
I'd just write a quick test harness to get the String that's
causing you problems, convert it to UTF-8 bytes and call
Base64.decode() yourself. Then you can just step through the
code and see which line is returning null. Then you'll know
what in particular it is objecting to (there are several
places in Base64.decode() where it can return null).

If you do this make sure that the String is correct when you
set it up i.e. that you convert it from whatever byte format
you are using for input (a File, an InputStream ...) using
the correct encoding (usually UTF-8 for XML - but you might
be overriding it). Otherwise your String will be wrong and
then the UTF-8 bytes will be wrong which will throw you off.

Cheers,

Lawrence

> -----Original Message-----
> From: Alistair Young [mailto:alistairsmo.uhi.ac.uk]
> Sent: Wednesday, January 18, 2006 3:18 AM
> To: userxmlbeans.apache.org
> Subject: X509 XmlValueOutOfRangeException
> 
> I have a signed xml packet that contains 4 X509 certs.
Two of them
> produce:
> 
> "XmlValueOutOfRangeException Invalid value: not
encoded properly"
> 
> when using X509DataType.getX509CertificateArray(). The
other 2 certs are
> fine.
> 
> Is there anything in the cert that could cause this
exception?
> 
> many thanks,
> 
> Alistair
> 
> 
> --
> Alistair Young
> Senior Software Engineer
> UHISabhal Mòr Ostaig
> Isle of Skye
> Scotland
> 
> 
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
> For additional commands, e-mail: user-helpxmlbeans.apache.org


------------------------------------------------------------
---------
To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org

X509 XmlValueOutOfRangeException
user name
2006-01-18 19:19:15
Thanks for that Lawrence, I'll give it a try. I strongly
suspect a dud
cert as well. I copied each of the 3 certs from the XML file
and pasted
each one into a BEGIN/END block for used CertificateFactory
to open them.
2 opened fine but the 1st had insufficient data to be read.

That would explain why XMLBeans was having trouble with it
but it doesn't
help with why the bean can't read the other cert that
CertificateFactory
could.

Would it help if I posted the XML with the signature and
X509s?

many thanks for your help,

Alistair


-- 
Alistair Young
Senior Software Engineer
UHISabhal Mòr Ostaig
Isle of Skye
Scotland

> Hi Alistair
>
> Without seeing the cert it's difficult to tell.
>
> According to the schema the X509CertificateArray type
within X509DataType
> is of type base64Binary. So your error is coming from
> org.apache.xmlbeans.impl.values.JavaBase64Holder in the
public method
> lex() at line 77. I apologise that the error message is
not very helpful -
> there's even a note in the code right there to say we
should update it
> when we get time.
>
> But the reason you're getting this is that it is unable
to decode the
> String that's being passed in. JavaBase64Holder.lex()
simply converts the
> String to UTF-8 bytes and then passes those bytes into
Base64.decode()
> which must be returning null for you to see this error.
>
> Base64.decode() is a public static method. So if I were
you I'd just write
> a quick test harness to get the String that's causing
you problems,
> convert it to UTF-8 bytes and call Base64.decode()
yourself. Then you can
> just step through the code and see which line is
returning null. Then
> you'll know what in particular it is objecting to
(there are several
> places in Base64.decode() where it can return null).
>
> If you do this make sure that the String is correct
when you set it up
> i.e. that you convert it from whatever byte format you
are using for input
> (a File, an InputStream ...) using the correct encoding
(usually UTF-8 for
> XML - but you might be overriding it). Otherwise your
String will be wrong
> and then the UTF-8 bytes will be wrong which will throw
you off.
>
> Cheers,
>
> Lawrence
>
>> -----Original Message-----
>> From: Alistair Young [mailto:alistairsmo.uhi.ac.uk]
>> Sent: Wednesday, January 18, 2006 3:18 AM
>> To: userxmlbeans.apache.org
>> Subject: X509 XmlValueOutOfRangeException
>>
>> I have a signed xml packet that contains 4 X509
certs. Two of them
>> produce:
>>
>> "XmlValueOutOfRangeException Invalid value:
not encoded properly"
>>
>> when using X509DataType.getX509CertificateArray().
The other 2 certs are
>> fine.
>>
>> Is there anything in the cert that could cause this
exception?
>>
>> many thanks,
>>
>> Alistair
>>
>>
>> --
>> Alistair Young
>> Senior Software Engineer
>> UHISabhal Mòr Ostaig
>> Isle of Skye
>> Scotland
>>
>>
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
>> For additional commands, e-mail: user-helpxmlbeans.apache.org
>
>


------------------------------------------------------------
---------
To unsubscribe, e-mail: user-unsubscribexmlbeans.apache.org
For additional commands, e-mail: user-helpxmlbeans.apache.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )