You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Colm O hEigeartaigh <co...@apache.org> on 2012/06/01 16:10:25 UTC

Re: Signing multiple files(images, sounds, HTML files, and CSS files)

The problem is that you are trying to apply an XML canonicalization
transform to data that is not XML. What algorithm(s) is/are in your
transform list?

Colm.

On Thu, May 31, 2012 at 9:21 AM, Pushpalanka Jayawardhana <
pushpalankajaya@gmail.com> wrote:

> I get the same error as of previous mail for mp3 files and when I give the
> URL of an image file following error occurs.
>
> Exception in thread "main"
> org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid
> byte 1 of 1-byte UTF-8 sequence.
> Original Exception was
> org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid
> byte 1 of 1-byte UTF-8 sequence.
> Original Exception was
> org.apache.xml.security.signature.XMLSignatureException: Invalid byte 1 of
> 1-byte UTF-8 sequence.
> Original Exception was
> org.apache.xml.security.transforms.TransformationException: Invalid byte 1
> of 1-byte UTF-8 sequence.
> Original Exception was
> org.apache.xml.security.c14n.CanonicalizationException: Invalid byte 1 of
> 1-byte UTF-8 sequence.
> Original Exception was
> org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of
> 1-byte UTF-8 sequence.
> at
> org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
>  at
> org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
>  at
> org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
> at
> org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
>
> Hope these details will be useful.
>
> On Thu, May 31, 2012 at 1:34 PM, Pushpalanka Jayawardhana <
> pushpalankajaya@gmail.com> wrote:
>
>> Hi all,
>>
>> I want to generate a detached signature for several files of the above
>> types. Going through archives I tried following.
>>
>> *sig.addDocument("/home/pushpalanka/Wookie/trunk/README",transforms,
>> Constants.ALGO_ID_DIGEST_SHA1 );*
>> *
>> *
>> But it gives the error,
>> [Fatal Error] :1:1: Content is not allowed in prolog.
>> Exception in thread "main"
>> org.apache.xml.security.signature.ReferenceNotInitializedException: Content
>> is not allowed in prolog.
>> Original Exception was
>> org.apache.xml.security.signature.ReferenceNotInitializedException: Content
>> is not allowed in prolog.
>> Original Exception was
>> org.apache.xml.security.signature.XMLSignatureException: Content is not
>> allowed in prolog.
>> Original Exception was
>> org.apache.xml.security.transforms.TransformationException: Content is not
>> allowed in prolog.
>> Original Exception was
>> org.apache.xml.security.c14n.CanonicalizationException: Content is not
>> allowed in prolog.
>> Original Exception was org.xml.sax.SAXParseException: Content is not
>> allowed in prolog.
>> at
>> org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
>>  at
>> org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
>>  at
>> org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
>>  at
>> org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
>>
>> I am grateful for any guidance on the correct way to do this.
>> --
>> Pushpalanka Jayawardhana | http://pushpalankajaya.blogspot.com
>>
>> Twitter: http://twitter.com/Pushpalanka | Slideshare:
>> http://www.slideshare.net/Pushpalanka
>>
>>
>>
>
>
> --
> Pushpalanka Jayawardhana | Undergraduate | Computer Science and Engineering
> University of Moratuwa
>
> +94779716248 | http://pushpalankajaya.blogspot.com
>
> Twitter: http://twitter.com/Pushpalanka | Slideshare:
> http://www.slideshare.net/Pushpalanka
>
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: Signing multiple files(images, sounds, HTML files, and CSS files)

Posted by Colm O hEigeartaigh <co...@apache.org>.
Try not using any Transform at all, e.g.:

*sig.addDocument("file:/home/pushpalanka/Wookie/trunk/README", null,
Constants.ALGO_ID_DIGEST_SHA1 );*
*
Colm.
*


On Fri, Jun 1, 2012 at 4:57 PM, Pushpalanka Jayawardhana <
pushpalankajaya@gmail.com> wrote:

> Hi Colm,
>
> Thanks a lot for the explanation.
> I am using
> TRANSFORM_C14N11_OMIT_COMMENTS - "http://www.w3.org/2006/12/xml-c14n11"
> algorithm.
>  With you guidance I tried to read more on canonicalization transform for
> non XML files, but failed to find any useful resource. Any comments will be
> so helpful.
>
>
> On Fri, Jun 1, 2012 at 7:40 PM, Colm O hEigeartaigh <co...@apache.org>wrote:
>
>>
>> The problem is that you are trying to apply an XML canonicalization
>> transform to data that is not XML. What algorithm(s) is/are in your
>> transform list?
>>
>> Colm.
>>
>>
>> On Thu, May 31, 2012 at 9:21 AM, Pushpalanka Jayawardhana <
>> pushpalankajaya@gmail.com> wrote:
>>
>>> I get the same error as of previous mail for mp3 files and when I give
>>> the URL of an image file following error occurs.
>>>
>>> Exception in thread "main"
>>> org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid
>>> byte 1 of 1-byte UTF-8 sequence.
>>> Original Exception was
>>> org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid
>>> byte 1 of 1-byte UTF-8 sequence.
>>> Original Exception was
>>> org.apache.xml.security.signature.XMLSignatureException: Invalid byte 1 of
>>> 1-byte UTF-8 sequence.
>>> Original Exception was
>>> org.apache.xml.security.transforms.TransformationException: Invalid byte 1
>>> of 1-byte UTF-8 sequence.
>>> Original Exception was
>>> org.apache.xml.security.c14n.CanonicalizationException: Invalid byte 1 of
>>> 1-byte UTF-8 sequence.
>>> Original Exception was
>>> org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of
>>> 1-byte UTF-8 sequence.
>>> at
>>> org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
>>>  at
>>> org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
>>>  at
>>> org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
>>> at
>>> org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
>>>
>>> Hope these details will be useful.
>>>
>>> On Thu, May 31, 2012 at 1:34 PM, Pushpalanka Jayawardhana <
>>> pushpalankajaya@gmail.com> wrote:
>>>
>>>> Hi all,
>>>>
>>>> I want to generate a detached signature for several files of the above
>>>> types. Going through archives I tried following.
>>>>
>>>> *sig.addDocument("/home/pushpalanka/Wookie/trunk/README",transforms,
>>>> Constants.ALGO_ID_DIGEST_SHA1 );*
>>>> *
>>>> *
>>>> But it gives the error,
>>>> [Fatal Error] :1:1: Content is not allowed in prolog.
>>>> Exception in thread "main"
>>>> org.apache.xml.security.signature.ReferenceNotInitializedException: Content
>>>> is not allowed in prolog.
>>>> Original Exception was
>>>> org.apache.xml.security.signature.ReferenceNotInitializedException: Content
>>>> is not allowed in prolog.
>>>> Original Exception was
>>>> org.apache.xml.security.signature.XMLSignatureException: Content is not
>>>> allowed in prolog.
>>>> Original Exception was
>>>> org.apache.xml.security.transforms.TransformationException: Content is not
>>>> allowed in prolog.
>>>> Original Exception was
>>>> org.apache.xml.security.c14n.CanonicalizationException: Content is not
>>>> allowed in prolog.
>>>> Original Exception was org.xml.sax.SAXParseException: Content is not
>>>> allowed in prolog.
>>>> at
>>>> org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
>>>>  at
>>>> org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
>>>>  at
>>>> org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
>>>>  at
>>>> org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
>>>>
>>>> I am grateful for any guidance on the correct way to do this.
>>>> --
>>>> Pushpalanka Jayawardhana | http://pushpalankajaya.blogspot.com
>>>>
>>>> Twitter: http://twitter.com/Pushpalanka | Slideshare:
>>>> http://www.slideshare.net/Pushpalanka
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Pushpalanka Jayawardhana | Undergraduate | Computer Science and
>>> Engineering
>>> University of Moratuwa
>>>
>>> +94779716248 | http://pushpalankajaya.blogspot.com
>>>
>>> Twitter: http://twitter.com/Pushpalanka | Slideshare:
>>> http://www.slideshare.net/Pushpalanka
>>>
>>>
>>>
>>
>>
>> --
>> Colm O hEigeartaigh
>>
>> Talend Community Coder
>> http://coders.talend.com
>>
>>
>
>
> --
> Pushpalanka Jayawardhana |
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: Signing multiple files(images, sounds, HTML files, and CSS files)

Posted by "Cantor, Scott" <ca...@osu.edu>.
On 6/1/12 2:42 PM, "Jean-Luc Cooke" <jl...@certainkey.com> wrote:

>There are none for non XML files.

There are none because the spec doesn't rely on them. If you sign raw
bytes, the reference is to an octet-stream, with no Transforms, and so the
digest is done over those octets directly.

The only reason it would break is if you specified a transform that
requires a node set, and then it would be obligated to parse the octets
into XML.

-- Scott

Re: Signing multiple files(images, sounds, HTML files, and CSS files)

Posted by Jean-Luc Cooke <jl...@certainkey.com>.
There are none for non XML files. 

Of you are bound an determined to sign raw bytes, you should use  CMS and BouncyCastle

Sent from my iPhone - exucse teh tpyos, I'm all thmuba

On 2012-06-01, at 11:57, Pushpalanka Jayawardhana <pu...@gmail.com> wrote:

> Hi Colm,
> 
> Thanks a lot for the explanation.
> I am using 
> TRANSFORM_C14N11_OMIT_COMMENTS - "http://www.w3.org/2006/12/xml-c14n11" algorithm.
>  With you guidance I tried to read more on canonicalization transform for non XML files, but failed to find any useful resource. Any comments will be so helpful.
> 
> 
> On Fri, Jun 1, 2012 at 7:40 PM, Colm O hEigeartaigh <co...@apache.org> wrote:
> 
> The problem is that you are trying to apply an XML canonicalization transform to data that is not XML. What algorithm(s) is/are in your transform list? 
> 
> Colm.
> 
> 
> On Thu, May 31, 2012 at 9:21 AM, Pushpalanka Jayawardhana <pu...@gmail.com> wrote:
> I get the same error as of previous mail for mp3 files and when I give the URL of an image file following error occurs.
> 
> Exception in thread "main" org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid byte 1 of 1-byte UTF-8 sequence.
> Original Exception was org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid byte 1 of 1-byte UTF-8 sequence.
> Original Exception was org.apache.xml.security.signature.XMLSignatureException: Invalid byte 1 of 1-byte UTF-8 sequence.
> Original Exception was org.apache.xml.security.transforms.TransformationException: Invalid byte 1 of 1-byte UTF-8 sequence.
> Original Exception was org.apache.xml.security.c14n.CanonicalizationException: Invalid byte 1 of 1-byte UTF-8 sequence.
> Original Exception was org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of 1-byte UTF-8 sequence.
> 	at org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
> 	at org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
> 	at org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
> 	at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
> 
> Hope these details will be useful.
> 
> On Thu, May 31, 2012 at 1:34 PM, Pushpalanka Jayawardhana <pu...@gmail.com> wrote:
> Hi all,
> 
> I want to generate a detached signature for several files of the above types. Going through archives I tried following.
> 
> sig.addDocument("/home/pushpalanka/Wookie/trunk/README",transforms, Constants.ALGO_ID_DIGEST_SHA1 );
> 
> But it gives the error,
> [Fatal Error] :1:1: Content is not allowed in prolog.
> Exception in thread "main" org.apache.xml.security.signature.ReferenceNotInitializedException: Content is not allowed in prolog.
> Original Exception was org.apache.xml.security.signature.ReferenceNotInitializedException: Content is not allowed in prolog.
> Original Exception was org.apache.xml.security.signature.XMLSignatureException: Content is not allowed in prolog.
> Original Exception was org.apache.xml.security.transforms.TransformationException: Content is not allowed in prolog.
> Original Exception was org.apache.xml.security.c14n.CanonicalizationException: Content is not allowed in prolog.
> Original Exception was org.xml.sax.SAXParseException: Content is not allowed in prolog.
> 	at org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
> 	at org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
> 	at org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
> 	at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
> 
> I am grateful for any guidance on the correct way to do this.
> -- 
> Pushpalanka Jayawardhana | http://pushpalankajaya.blogspot.com
> Twitter: http://twitter.com/Pushpalanka | Slideshare: http://www.slideshare.net/Pushpalanka
> 
> 
> 
> 
> 
> -- 
> Pushpalanka Jayawardhana | Undergraduate | Computer Science and Engineering
> University of Moratuwa
> +94779716248 | http://pushpalankajaya.blogspot.com
> Twitter: http://twitter.com/Pushpalanka | Slideshare: http://www.slideshare.net/Pushpalanka
> 
> 
> 
> 
> 
> -- 
> Colm O hEigeartaigh
> 
> Talend Community Coder
> http://coders.talend.com
> 
> 
> 
> 
> -- 
> Pushpalanka Jayawardhana |
> 

Re: Signing multiple files(images, sounds, HTML files, and CSS files)

Posted by Pushpalanka Jayawardhana <pu...@gmail.com>.
Hi Colm,

Thanks a lot for the explanation.
I am using
TRANSFORM_C14N11_OMIT_COMMENTS - "http://www.w3.org/2006/12/xml-c14n11"
algorithm.
 With you guidance I tried to read more on canonicalization transform for
non XML files, but failed to find any useful resource. Any comments will be
so helpful.


On Fri, Jun 1, 2012 at 7:40 PM, Colm O hEigeartaigh <co...@apache.org>wrote:

>
> The problem is that you are trying to apply an XML canonicalization
> transform to data that is not XML. What algorithm(s) is/are in your
> transform list?
>
> Colm.
>
>
> On Thu, May 31, 2012 at 9:21 AM, Pushpalanka Jayawardhana <
> pushpalankajaya@gmail.com> wrote:
>
>> I get the same error as of previous mail for mp3 files and when I give
>> the URL of an image file following error occurs.
>>
>> Exception in thread "main"
>> org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid
>> byte 1 of 1-byte UTF-8 sequence.
>> Original Exception was
>> org.apache.xml.security.signature.ReferenceNotInitializedException: Invalid
>> byte 1 of 1-byte UTF-8 sequence.
>> Original Exception was
>> org.apache.xml.security.signature.XMLSignatureException: Invalid byte 1 of
>> 1-byte UTF-8 sequence.
>> Original Exception was
>> org.apache.xml.security.transforms.TransformationException: Invalid byte 1
>> of 1-byte UTF-8 sequence.
>> Original Exception was
>> org.apache.xml.security.c14n.CanonicalizationException: Invalid byte 1 of
>> 1-byte UTF-8 sequence.
>> Original Exception was
>> org.apache.xerces.impl.io.MalformedByteSequenceException: Invalid byte 1 of
>> 1-byte UTF-8 sequence.
>> at
>> org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
>>  at
>> org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
>>  at
>> org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
>> at
>> org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
>>
>> Hope these details will be useful.
>>
>> On Thu, May 31, 2012 at 1:34 PM, Pushpalanka Jayawardhana <
>> pushpalankajaya@gmail.com> wrote:
>>
>>> Hi all,
>>>
>>> I want to generate a detached signature for several files of the above
>>> types. Going through archives I tried following.
>>>
>>> *sig.addDocument("/home/pushpalanka/Wookie/trunk/README",transforms,
>>> Constants.ALGO_ID_DIGEST_SHA1 );*
>>> *
>>> *
>>> But it gives the error,
>>> [Fatal Error] :1:1: Content is not allowed in prolog.
>>> Exception in thread "main"
>>> org.apache.xml.security.signature.ReferenceNotInitializedException: Content
>>> is not allowed in prolog.
>>> Original Exception was
>>> org.apache.xml.security.signature.ReferenceNotInitializedException: Content
>>> is not allowed in prolog.
>>> Original Exception was
>>> org.apache.xml.security.signature.XMLSignatureException: Content is not
>>> allowed in prolog.
>>> Original Exception was
>>> org.apache.xml.security.transforms.TransformationException: Content is not
>>> allowed in prolog.
>>> Original Exception was
>>> org.apache.xml.security.c14n.CanonicalizationException: Content is not
>>> allowed in prolog.
>>> Original Exception was org.xml.sax.SAXParseException: Content is not
>>> allowed in prolog.
>>> at
>>> org.apache.xml.security.signature.Reference.calculateDigest(Reference.java:710)
>>>  at
>>> org.apache.xml.security.signature.Reference.generateDigestValue(Reference.java:396)
>>>  at
>>> org.apache.xml.security.signature.Manifest.generateDigestValues(Manifest.java:206)
>>>  at
>>> org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:595)
>>>
>>> I am grateful for any guidance on the correct way to do this.
>>> --
>>> Pushpalanka Jayawardhana | http://pushpalankajaya.blogspot.com
>>>
>>> Twitter: http://twitter.com/Pushpalanka | Slideshare:
>>> http://www.slideshare.net/Pushpalanka
>>>
>>>
>>>
>>
>>
>> --
>> Pushpalanka Jayawardhana | Undergraduate | Computer Science and
>> Engineering
>> University of Moratuwa
>>
>> +94779716248 | http://pushpalankajaya.blogspot.com
>>
>> Twitter: http://twitter.com/Pushpalanka | Slideshare:
>> http://www.slideshare.net/Pushpalanka
>>
>>
>>
>
>
> --
> Colm O hEigeartaigh
>
> Talend Community Coder
> http://coders.talend.com
>
>


-- 
Pushpalanka Jayawardhana |