You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by Xinjun Chen <xj...@gmail.com> on 2006/03/21 03:48:27 UTC

Re: Invalid key length, (previously) CryptoFactory: Cannot load properties: crypto.properties

Hi Werner,

Thank you for your reply.
I put the crypto.properties file into the output directory of the test
eclipse project, then it did not complain the "cannot load crypto.properties"
error. I also found that wss4j have dependency on opensaml.jar
commons-digest.jar, and xalan.jar at runtime.
However, I still could not managed to get the the simple program running.
The following error occurs complaining about the Invalid key length.

When I debug the program, the debug window is as follows:
XMLCipher.doFinal(Document, Element, boolean) line: not available
WSEncryptBody.doEncryption(Document, SecretKey, KeyInfo) line: 521
WSEncryptBody.buildEmbedded(Document, Crypto) line 585
WSEncryptBody.build(Document, Crypto) line: 283
SenderHandler.addUserTokens() line: 132.

Though the eclipse debug window reports that doFinal(Document, Element,
boolean) line is not available, I can in fact view the source code in the
main window. The debug just stops there, "Step Into" and "Step Over"
commands get no response. If I "Resume" the debug, then the appended
exception occurs.
Is this some bug in xmlsec.jar or I have made some mistake somewhere?
Please point me a way out...

Error Message:

org.apache.ws.security.WSSecurityException: Cannot encrypt/decrypt data;
nested exception is:
org.apache.xml.security.encryption.XMLEncryptionException: Invalid key
length: 8 bytes
Original Exception was java.security.InvalidKeyException: Invalid key
length: 8 bytes
at org.apache.ws.security.message.WSEncryptBody.doEncryption(
WSEncryptBody.java:523)
at org.apache.ws.security.message.WSEncryptBody.buildEmbedded(
WSEncryptBody.java:585)
at org.apache.ws.security.message.WSEncryptBody.build(WSEncryptBody.java
:283)
at
com.crimsonlogic.wsgate.core.ws.handler.security2.SenderHandler.addUserTokens
(SenderHandler.java:132)
at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.test(
TestSecurity.java:136)
at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.main(
TestSecurity.java:50)
Caused by: org.apache.xml.security.encryption.XMLEncryptionException:
Invalid key length: 8 bytes
Original Exception was java.security.InvalidKeyException: Invalid key
length: 8 bytes
at org.apache.xml.security.encryption.XMLCipher.encryptData(Unknown Source)
at org.apache.xml.security.encryption.XMLCipher.encryptElementContent(Unknown
Source)
at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
at org.apache.ws.security.message.WSEncryptBody.doEncryption(
WSEncryptBody.java:521)
... 5 more

Regards,
Xinjun

On 3/20/06, Dittmann, Werner <we...@siemens.com> wrote:
>
>  Seems to be a classloader problem together with Axis2?
>
> Regards,
> Werner
>
>  ------------------------------
> *Von:* Xinjun Chen [mailto:xjchen001@gmail.com]
> *Gesendet:* Montag, 20. März 2006 04:37
> *An:* wss4j-dev@ws.apache.org
> *Betreff:* CryptoFactory: Cannot load properties: crypto.properties
>
>
>
>   Hi,
> When I write simple SecurityHandler use the StAX and WSS4J in Axis2, the
> exception appended occurs.
> I tried the following testings:
> 1. Put the crypto.properties and keys/x509.PFX.MSFT are in the same folder
> as the TestSecurity.class. I still get the exception that the
> crypto.properties cannot be loaded.
> 2. I tried to load the crypto.properties file from inside the
> TestSecurity.class, the property file can be loaded.
> 3. I tried to put the path of the directory which contains
> crypto.properties file in the classpath (set the user Environment Variable
> in Windows), and I still failed to load the crypto.properties.
> 3. I tried to put the path of the crypto.properties file in the classpath
> (set the user Environment Variable in Windows), and I failed to load the
> crypto.properties again.
>
> Could anyone point me a way out?
> PS: accidentally I posted this question in Axis maillist just now. Please
> forgive me if you have read the question in Axis-user maillist.
>
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.test(
> TestSecurity.java:132)
> at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.main (
> TestSecurity.java:46)
> Caused by: java.lang.RuntimeException: CryptoFactory: Cannot load
> properties: crypto.properties
> at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(
> CryptoFactory.java:150)
> at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(
> CryptoFactory.java:96)
> at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(
> CryptoFactory.java:54)
> at com.crimsonlogic.wsgate.core.ws.handler.security2.SenderHandler.<clinit>(
> SenderHandler.java:34)
> ... 2 more
>
> Regards,
>
> Xinjun
>
>

Re: Invalid key length, (previously) CryptoFactory: Cannot load properties: crypto.properties

Posted by Xinjun Chen <xj...@gmail.com>.
Could you enlighten me what's wrong there?
As I said in the previous posting, I have been stumped here for quite a few
day.
Please shed your lights.

Regards,
Xinjun


On 3/21/06, Xinjun Chen <xj...@gmail.com> wrote:
>
>  Hi Werner,
>
> Thank you for your reply.
> I put the crypto.properties file into the output directory of the test
> eclipse project, then it did not complain the "cannot load
> crypto.properties" error. I also found that wss4j have dependency on
> opensaml.jar commons-digest.jar, and xalan.jar at runtime.
> However, I still could not managed to get the the simple program running.
> The following error occurs complaining about the Invalid key length.
>
> When I debug the program, the debug window is as follows:
> XMLCipher.doFinal(Document, Element, boolean) line: not available
> WSEncryptBody.doEncryption(Document, SecretKey, KeyInfo) line: 521
> WSEncryptBody.buildEmbedded(Document, Crypto) line 585
> WSEncryptBody.build(Document, Crypto) line: 283
> SenderHandler.addUserTokens() line: 132.
>
> Though the eclipse debug window reports that doFinal(Document, Element,
> boolean) line is not available, I can in fact view the source code in the
> main window. The debug just stops there, "Step Into" and "Step Over"
> commands get no response. If I "Resume" the debug, then the appended
> exception occurs.
> Is this some bug in xmlsec.jar or I have made some mistake somewhere?
> Please point me a way out...
>
> Error Message:
>
> org.apache.ws.security.WSSecurityException: Cannot encrypt/decrypt data;
> nested exception is:
> org.apache.xml.security.encryption.XMLEncryptionException: Invalid key
> length: 8 bytes
> Original Exception was java.security.InvalidKeyException: Invalid key
> length: 8 bytes
> at org.apache.ws.security.message.WSEncryptBody.doEncryption(
> WSEncryptBody.java:523)
> at org.apache.ws.security.message.WSEncryptBody.buildEmbedded(
> WSEncryptBody.java :585)
> at org.apache.ws.security.message.WSEncryptBody.build(WSEncryptBody.java
> :283)
> at
> com.crimsonlogic.wsgate.core.ws.handler.security2.SenderHandler.addUserTokens
> (SenderHandler.java:132)
> at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.test (
> TestSecurity.java:136)
> at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.main(
> TestSecurity.java:50)
> Caused by: org.apache.xml.security.encryption.XMLEncryptionException:
> Invalid key length: 8 bytes
> Original Exception was java.security.InvalidKeyException: Invalid key
> length: 8 bytes
> at org.apache.xml.security.encryption.XMLCipher.encryptData(Unknown
> Source)
> at org.apache.xml.security.encryption.XMLCipher.encryptElementContent(Unknown
> Source)
> at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
> at org.apache.ws.security.message.WSEncryptBody.doEncryption(
> WSEncryptBody.java:521)
> ... 5 more
>
> Regards,
> Xinjun
>
> On 3/20/06, Dittmann, Werner <we...@siemens.com> wrote:
> >
> >  Seems to be a classloader problem together with Axis2?
> >
> > Regards,
> > Werner
> >
> >  ------------------------------
> > *Von:* Xinjun Chen [mailto:xjchen001@gmail.com]
> > *Gesendet:* Montag, 20. März 2006 04:37
> > *An:* wss4j-dev@ws.apache.org
> > *Betreff:* CryptoFactory: Cannot load properties: crypto.properties
> >
> >
> >
> >   Hi,
> > When I write simple SecurityHandler use the StAX and WSS4J in Axis2, the
> > exception appended occurs.
> > I tried the following testings:
> > 1. Put the crypto.properties and keys/x509.PFX.MSFT are in the same
> > folder as the TestSecurity.class. I still get the exception that the
> > crypto.properties cannot be loaded.
> > 2. I tried to load the crypto.properties file from inside the
> > TestSecurity.class, the property file can be loaded.
> > 3. I tried to put the path of the directory which contains
> > crypto.properties file in the classpath (set the user Environment
> > Variable in Windows), and I still failed to load the crypto.properties.
> > 3. I tried to put the path of the crypto.properties file in the
> > classpath (set the user Environment Variable in Windows), and I failed to
> > load the crypto.properties again.
> >
> > Could anyone point me a way out?
> > PS: accidentally I posted this question in Axis maillist just now.
> > Please forgive me if you have read the question in Axis-user maillist.
> >
> > Exception in thread "main" java.lang.ExceptionInInitializerError
> > at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.test(
> > TestSecurity.java:132)
> > at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.main (
> > TestSecurity.java:46)
> > Caused by: java.lang.RuntimeException: CryptoFactory: Cannot load
> > properties: crypto.properties
> > at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(
> > CryptoFactory.java:150)
> > at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(
> > CryptoFactory.java:96)
> > at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(
> > CryptoFactory.java:54)
> > at com.crimsonlogic.wsgate.core.ws.handler.security2.SenderHandler.<clinit>(
> > SenderHandler.java:34)
> > ... 2 more
> >
> > Regards,
> >
> > Xinjun
> >
> >
>
>

Re: Invalid key length, (previously) CryptoFactory: Cannot load properties: crypto.properties

Posted by Xinjun Chen <xj...@gmail.com>.
Could you enlighten me what's wrong there?
As I said in the previous posting, I have been stumped here for quite a few
day.
Please shed your lights.

Regards,
Xinjun


On 3/21/06, Xinjun Chen <xj...@gmail.com> wrote:
>
>  Hi Werner,
>
> Thank you for your reply.
> I put the crypto.properties file into the output directory of the test
> eclipse project, then it did not complain the "cannot load
> crypto.properties" error. I also found that wss4j have dependency on
> opensaml.jar commons-digest.jar, and xalan.jar at runtime.
> However, I still could not managed to get the the simple program running.
> The following error occurs complaining about the Invalid key length.
>
> When I debug the program, the debug window is as follows:
> XMLCipher.doFinal(Document, Element, boolean) line: not available
> WSEncryptBody.doEncryption(Document, SecretKey, KeyInfo) line: 521
> WSEncryptBody.buildEmbedded(Document, Crypto) line 585
> WSEncryptBody.build(Document, Crypto) line: 283
> SenderHandler.addUserTokens() line: 132.
>
> Though the eclipse debug window reports that doFinal(Document, Element,
> boolean) line is not available, I can in fact view the source code in the
> main window. The debug just stops there, "Step Into" and "Step Over"
> commands get no response. If I "Resume" the debug, then the appended
> exception occurs.
> Is this some bug in xmlsec.jar or I have made some mistake somewhere?
> Please point me a way out...
>
> Error Message:
>
> org.apache.ws.security.WSSecurityException: Cannot encrypt/decrypt data;
> nested exception is:
> org.apache.xml.security.encryption.XMLEncryptionException: Invalid key
> length: 8 bytes
> Original Exception was java.security.InvalidKeyException: Invalid key
> length: 8 bytes
> at org.apache.ws.security.message.WSEncryptBody.doEncryption(
> WSEncryptBody.java:523)
> at org.apache.ws.security.message.WSEncryptBody.buildEmbedded(
> WSEncryptBody.java :585)
> at org.apache.ws.security.message.WSEncryptBody.build(WSEncryptBody.java
> :283)
> at
> com.crimsonlogic.wsgate.core.ws.handler.security2.SenderHandler.addUserTokens
> (SenderHandler.java:132)
> at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.test (
> TestSecurity.java:136)
> at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.main(
> TestSecurity.java:50)
> Caused by: org.apache.xml.security.encryption.XMLEncryptionException:
> Invalid key length: 8 bytes
> Original Exception was java.security.InvalidKeyException: Invalid key
> length: 8 bytes
> at org.apache.xml.security.encryption.XMLCipher.encryptData(Unknown
> Source)
> at org.apache.xml.security.encryption.XMLCipher.encryptElementContent(Unknown
> Source)
> at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
> at org.apache.ws.security.message.WSEncryptBody.doEncryption(
> WSEncryptBody.java:521)
> ... 5 more
>
> Regards,
> Xinjun
>
> On 3/20/06, Dittmann, Werner <we...@siemens.com> wrote:
> >
> >  Seems to be a classloader problem together with Axis2?
> >
> > Regards,
> > Werner
> >
> >  ------------------------------
> > *Von:* Xinjun Chen [mailto:xjchen001@gmail.com]
> > *Gesendet:* Montag, 20. März 2006 04:37
> > *An:* wss4j-dev@ws.apache.org
> > *Betreff:* CryptoFactory: Cannot load properties: crypto.properties
> >
> >
> >
> >   Hi,
> > When I write simple SecurityHandler use the StAX and WSS4J in Axis2, the
> > exception appended occurs.
> > I tried the following testings:
> > 1. Put the crypto.properties and keys/x509.PFX.MSFT are in the same
> > folder as the TestSecurity.class. I still get the exception that the
> > crypto.properties cannot be loaded.
> > 2. I tried to load the crypto.properties file from inside the
> > TestSecurity.class, the property file can be loaded.
> > 3. I tried to put the path of the directory which contains
> > crypto.properties file in the classpath (set the user Environment
> > Variable in Windows), and I still failed to load the crypto.properties.
> > 3. I tried to put the path of the crypto.properties file in the
> > classpath (set the user Environment Variable in Windows), and I failed to
> > load the crypto.properties again.
> >
> > Could anyone point me a way out?
> > PS: accidentally I posted this question in Axis maillist just now.
> > Please forgive me if you have read the question in Axis-user maillist.
> >
> > Exception in thread "main" java.lang.ExceptionInInitializerError
> > at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.test(
> > TestSecurity.java:132)
> > at com.crimsonlogic.wsgate.core.ws.handler.test.TestSecurity.main (
> > TestSecurity.java:46)
> > Caused by: java.lang.RuntimeException: CryptoFactory: Cannot load
> > properties: crypto.properties
> > at org.apache.ws.security.components.crypto.CryptoFactory.getProperties(
> > CryptoFactory.java:150)
> > at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(
> > CryptoFactory.java:96)
> > at org.apache.ws.security.components.crypto.CryptoFactory.getInstance(
> > CryptoFactory.java:54)
> > at com.crimsonlogic.wsgate.core.ws.handler.security2.SenderHandler.<clinit>(
> > SenderHandler.java:34)
> > ... 2 more
> >
> > Regards,
> >
> > Xinjun
> >
> >
>
>