You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Anton Ivanov (JIRA)" <ji...@apache.org> on 2006/12/07 16:07:22 UTC

[jira] Updated: (HARMONY-2524) javax.crypto.CipherSpi.engineUpdate(ByteBuffer in, ByteBuffer out) method throws NullPointerException on correct input

     [ http://issues.apache.org/jira/browse/HARMONY-2524?page=all ]

Anton Ivanov updated HARMONY-2524:
----------------------------------

    Attachment: CipherSpiImplTest.java

The test to reproduce the problem is in the attachement.
We create a concrete cipher, that never store bytes to output and its method engineUpdate(byte[] in, int offset, int length) will always return null.
So if we try to call engineUpdate(ByteBuffer in, ByteBuffer out) we will obtain NullPointerException as it is mentioned above.

Output on Harmony:

FAILED
java.lang.NullPointerException
        at javax.crypto.CipherSpi.engineUpdate(CipherSpi.java:155)
        at CipherSpiImpl.engineUpdate(CipherSpiImplTest.java:111)
        at CipherSpiImplTest.main(CipherSpiImplTest.java:33)

Output on RI:

PASSED
total number of bytes stored to out:0

> javax.crypto.CipherSpi.engineUpdate(ByteBuffer in, ByteBuffer out) method throws NullPointerException on correct input
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2524
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2524
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Anton Ivanov
>         Attachments: CipherSpiImplTest.java
>
>
> The problem is as follows:
> An underlying cipher can be a blocked cipher. So an input data may be too short to result in a block after encryption/decryption done
> (method javax.crypto.CipherSpi.engineUpdate(byte[] in, int  offset, int length) will return null in such a case).
> If we call javax.crypto.CipherSpi.engineUpdate(ByteBuffer in, ByteBuffer out) method where in parameter is such a short block we will
> obtain a NullPointerException. While according to the specification we have to only return 0 (total number of bytes stored in output)
> and have not to throw NullPointerException.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira