You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by bu...@apache.org on 2007/02/01 22:37:11 UTC

DO NOT REPLY [Bug 41520] New: - Cannot generate with the same key but different algorithms

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41520

           Summary: Cannot generate with the same key but different
                    algorithms
           Product: Security
           Version: Java 1.3
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: PatchAvailable
          Severity: major
          Priority: P2
         Component: Signature
        AssignedTo: security-dev@xml.apache.org
        ReportedBy: lijun.liao@gmail.com


If you issue a second signature but with different algorithm, e.g., RSAWithSHA1
for the first signature, and RSAWithRipeMD160 for the second, you will get the
exception that says:
 org.apache.xml.security.signature.XMLSignatureException: object not initialized
for signature or verification
Original Exception was java.security.SignatureException: object not initialized
for signature or verification
	at
org.apache.xml.security.algorithms.implementations.SignatureBaseRSA.engineUpdate(SignatureBaseRSA.java:203)
	at
org.apache.xml.security.algorithms.SignatureAlgorithm.update(SignatureAlgorithm.java:249)
	at
org.apache.xml.security.utils.SignerOutputStream.write(SignerOutputStream.java:64)
	at
org.apache.xml.security.utils.UnsyncBufferedOutputStream.flushBuffer(UnsyncBufferedOutputStream.java:69)
	at
org.apache.xml.security.utils.UnsyncBufferedOutputStream.flush(UnsyncBufferedOutputStream.java:85)
	at
org.apache.xml.security.utils.UnsyncBufferedOutputStream.close(UnsyncBufferedOutputStream.java:91)
	at
org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(CanonicalizerBase.java:207)
	at
org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(CanonicalizerBase.java:121)
	at
org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Canonicalizer.java:268)
	at
org.apache.xml.security.signature.SignedInfo.signInOctectStream(SignedInfo.java:286)
	at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:501)
	at
org.apache.xml.security.samples.signature.CopyOfCreateSignature.sign(CopyOfCreateSignature.java:172)
	at
org.apache.xml.security.samples.signature.CopyOfCreateSignature.main(CopyOfCreateSignature.java:83)
java.security.SignatureException: object not initialized for signature or
verification
	at java.security.Signature.update(Signature.java:690)
	at
org.apache.xml.security.algorithms.implementations.SignatureBaseRSA.engineUpdate(SignatureBaseRSA.java:201)
	at
org.apache.xml.security.algorithms.SignatureAlgorithm.update(SignatureAlgorithm.java:249)
	at
org.apache.xml.security.utils.SignerOutputStream.write(SignerOutputStream.java:64)
	at
org.apache.xml.security.utils.UnsyncBufferedOutputStream.flushBuffer(UnsyncBufferedOutputStream.java:69)
	at
org.apache.xml.security.utils.UnsyncBufferedOutputStream.flush(UnsyncBufferedOutputStream.java:85)
	at
org.apache.xml.security.utils.UnsyncBufferedOutputStream.close(UnsyncBufferedOutputStream.java:91)
	at
org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(CanonicalizerBase.java:207)
	at
org.apache.xml.security.c14n.implementations.CanonicalizerBase.engineCanonicalizeSubTree(CanonicalizerBase.java:121)
	at
org.apache.xml.security.c14n.Canonicalizer.canonicalizeSubtree(Canonicalizer.java:268)
	at
org.apache.xml.security.signature.SignedInfo.signInOctectStream(SignedInfo.java:286)
	at org.apache.xml.security.signature.XMLSignature.sign(XMLSignature.java:501)
	at
org.apache.xml.security.samples.signature.CopyOfCreateSignature.sign(CopyOfCreateSignature.java:172)
	at
org.apache.xml.security.samples.signature.CopyOfCreateSignature.main(CopyOfCreateSignature.java:83).
This problem is caused by the initSign method in class SignatureAlgorithm:
[1]   public void initSign(Key signingKey) throws XMLSignatureException {	   
[2]	   initializeAlgorithm(true);
[3]	    if (keysSigning.get()==signingKey) {
[4]    	   return;
[5]       }
[6]       keysSigning.set(signingKey);
[7]	   this._signatureAlgorithm.engineInitSign(signingKey);
[8]   }
The lines 3-5 should be commented to solve above problem.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 41520] - Cannot generate signatures with the same key but different algorithms in sucession

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41520





------- Additional Comments From sean.mullan@sun.com  2007-02-21 08:29 -------
*** Bug 41519 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 41520] - Cannot generate signatures with the same key but different algorithms in sucession

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41520


raul-info@r-bg.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From raul-info@r-bg.com  2007-03-07 02:45 -------
Fixed in SVN head, fixed without removing the optimization or not reinitializing
the Signer (a little expensive operation).

Thanks for notifying and your patch.

Can you test svn head to see if it works for you?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 41520] - Cannot generate signatures with the same key but different algorithms in sucession

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41520


sean.mullan@sun.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED




------- Additional Comments From sean.mullan@sun.com  2007-09-19 12:28 -------
Closing old bugs. Fixed in 1.4.1

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 41520] - Cannot generate signatures with the same key but different algorithms in sucession

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41520





------- Additional Comments From lijun.liao@gmail.com  2007-02-02 02:48 -------
There is the same problem if you try to verify two signatures with the same
public key but with different signature algorithms. 
[1]   public void initVerify(Key verificationKey) throws XMLSignatureException {
[2]	   initializeAlgorithm(false);
[3]	   if (keysVerify.get()==verificationKey) {
[4]    	   return;
[5]       }
[6]	   keysVerify.set(verificationKey);
[7]	   this._signatureAlgorithm.engineInitVerify(verificationKey);
[8]   }

The the code in lines 3-5 should be commented to solve the problem.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

DO NOT REPLY [Bug 41520] - Cannot generate signatures with the same key but different algorithms in sucession

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41520>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41520


lijun.liao@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Cannot generate with the    |Cannot generate signatures
                   |same key but different      |with the same key but
                   |algorithms                  |different algorithms in
                   |                            |sucession




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.