You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by JC Tchitchiama <jc...@panonet.net> on 2002/10/30 20:34:18 UTC

Decryption Exception

All,

I am running a similar example to the one Carlos posted (encrypt/decrypt )and 
I am getting the exception below. I ahave also dowloaded the latest CVS asof 
(2002/10/30). If anybody can help is understanding what I am doing wrong then
please shout.
Best Regards.

JC.


run:
org.apache.xml.security.algorithms.encryption.helper.InvalidCipherTextException: 
unknown block type
     [java]     at 
org.apache.xml.security.algorithms.encryption.helper.PKCS15Cipher.decodeBlock(Unknown 
Source)
     [java]     at 
org.apache.xml.security.algorithms.encryption.implementations.BC.KeyTransportImpl_RSAPKCS15_BC.engineUnwrap(Unknown 
Source)
     [java]     at 
org.apache.xml.security.algorithms.encryption.EncryptionMethod.unwrap(Unknown 
Source)
     [java]     at 
com.psymetrix.msf.security.xml.signature.XMLEncryptionHandler.decrypt(Unknown 
Source)
[java]     at 
com.psymetrix.msf.security.xml.signature.XMLSignatureHandlerTest.main(Unknown 
Source)


==================================================================
jct@panonet.net
=================================================================


Re: Decryption Exception

Posted by Christian Geuer-Pollmann <ge...@nue.et-inf.uni-siegen.de>.
Look in the source:

PKCS15Cipher:

   public byte[] decodeBlock(byte[] in, int inOff, int inLen)
           throws InvalidCipherTextException, IllegalBlockSizeException,
                  BadPaddingException {
      byte[] block = this._cipher.doFinal(in, inOff, inLen);

      ...

      if (block[0] != 0x02) {
         throw new InvalidCipherTextException(
            "encryption.RSAPKCS15.unknownBlockType");
      }


So if the first octet is not 0x02, you made something wrong during wrapping 
the key. And no, you can't control the creation as there is no freedom to 
supply attributes. Simply wrap using PKCS15

Christian


--On Donnerstag, 31. Oktober 2002 12:04 +0100 JC Tchitchiama 
<jc...@panonet.net> wrote:

> Can you suggest a work around. I thought that No Padding was being
> applied. Is there an attribute I can set at Key creation phase to specify
> this


Re: Decryption Exception

Posted by JC Tchitchiama <jc...@panonet.net>.
Christian,

Can you suggest a work around. I thought that No Padding was being applied.
Is there an attribute I can set at Key creation phase to specify this

Ta
JC

On Wednesday 30 Oct 2002 8:12 pm, Christian Geuer-Pollmann wrote:
> PKCS 1.5 does a padding before encryption. If the padding is not correct
> after decryption, you get the InvalidCipherTextException.
>
>
> --On Mittwoch, 30. Oktober 2002 20:34 +0100 JC Tchitchiama
>
> <jc...@panonet.net> wrote:
> > All,
> >
> > I am running a similar example to the one Carlos posted (encrypt/decrypt
> > )and  I am getting the exception below. I ahave also dowloaded the latest
> > CVS asof  (2002/10/30). If anybody can help is understanding what I am
> > doing wrong then please shout.
> > Best Regards.
> >
> > JC.
> >
> >
> > run:
> > org.apache.xml.security.algorithms.encryption.helper.InvalidCipherTextExc
> > eption:  unknown block type
> >      [java]     at
> > org.apache.xml.security.algorithms.encryption.helper.PKCS15Cipher.decodeB
> > lock(Unknown  Source)
> >      [java]     at
> > org.apache.xml.security.algorithms.encryption.implementations.BC.KeyTrans
> > portImpl_RSAPKCS15_BC.engineUnwrap(Unknown  Source)
> >      [java]     at
> > org.apache.xml.security.algorithms.encryption.EncryptionMethod.unwrap(Unk
> > nown  Source)
> >      [java]     at
> > com.psymetrix.msf.security.xml.signature.XMLEncryptionHandler.decrypt(Unk
> > nown  Source)
> > [java]     at
> > com.psymetrix.msf.security.xml.signature.XMLSignatureHandlerTest.main(Unk
> > nown  Source)
> >
> >
> > ==================================================================
> > jct@panonet.net
> > =================================================================

-- 

Best Regards.

JC.
==================================================================
jct@panonet.net
=================================================================


Re: Decryption Exception

Posted by Christian Geuer-Pollmann <ge...@nue.et-inf.uni-siegen.de>.

PKCS 1.5 does a padding before encryption. If the padding is not correct 
after decryption, you get the InvalidCipherTextException.


--On Mittwoch, 30. Oktober 2002 20:34 +0100 JC Tchitchiama 
<jc...@panonet.net> wrote:

> All,
>
> I am running a similar example to the one Carlos posted (encrypt/decrypt
> )and  I am getting the exception below. I ahave also dowloaded the latest
> CVS asof  (2002/10/30). If anybody can help is understanding what I am
> doing wrong then please shout.
> Best Regards.
>
> JC.
>
>
> run:
> org.apache.xml.security.algorithms.encryption.helper.InvalidCipherTextExc
> eption:  unknown block type
>      [java]     at
> org.apache.xml.security.algorithms.encryption.helper.PKCS15Cipher.decodeB
> lock(Unknown  Source)
>      [java]     at
> org.apache.xml.security.algorithms.encryption.implementations.BC.KeyTrans
> portImpl_RSAPKCS15_BC.engineUnwrap(Unknown  Source)
>      [java]     at
> org.apache.xml.security.algorithms.encryption.EncryptionMethod.unwrap(Unk
> nown  Source)
>      [java]     at
> com.psymetrix.msf.security.xml.signature.XMLEncryptionHandler.decrypt(Unk
> nown  Source)
> [java]     at
> com.psymetrix.msf.security.xml.signature.XMLSignatureHandlerTest.main(Unk
> nown  Source)
>
>
> ==================================================================
> jct@panonet.net
> =================================================================
>