harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stepan Mishura (JIRA)" <j...@apache.org>
Subject [jira] Reopened: (HARMONY-2680) [classlib][security]AlgorithmParameters.getEncoded(null) throws NullPointerException on Harmony but not on RI.
Date Mon, 18 Dec 2006 16:47:23 GMT
     [ http://issues.apache.org/jira/browse/HARMONY-2680?page=all ]

Stepan Mishura reopened HARMONY-2680:
-------------------------------------

             
Hi Leo,

Thank you for improving security code. As far as we have no agreement and I think we have
further discussion I'm reopening the bug.

If I understood you correctly you suggested to check for "null" param in AlgorithmParameters
and if it is null pass to spi-provider(BouncyCastle) not-null value. I'm not quite sure that
this is correct approach. 

To summarize:
1) I think this is a bug of BouncyCastle because the spec. for AlgorithmParametersSpi.engineGetEncoded(String
format) that is implemented by BouncyCastle says: "... If format is null, the primary encoding
format for parameters is used... "

So null value is allowed for spi-method and BouncyCastle shouldn't throw NullPointerException

2) Harmony implementation follows the spec. The spec. doesn't obligate implementation to check
parameters passed to provider - this is up to provider to decide whether parameter is valid
or not. For example, another provider may use not "ASN.1" in case of 'null' format parameter.

3) The test case above passed on RI so I guess BouncyCastle fails with NullPointerException.
And I think we shouldn't mask this - otherwise the provider will behave differently on RI
and Harmony.

We have number of similar issues related to BouncyCastle provider I think we should collect
them and discuss how to resolve.

Thanks,
Stepan.


> [classlib][security]AlgorithmParameters.getEncoded(null) throws NullPointerException
on Harmony but not on RI.
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-2680
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2680
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Leo Li
>         Assigned To: Stepan Mishura
>         Attachments: patch-2680.diff
>
>
> Here is the testcase:
> public void test_algorithmParameters_getEncoded() throws Exception
>     {
>         AlgorithmParameters algorithmParameters = AlgorithmParameters.getInstance("DSA");
>         algorithmParameters.init(new DSAParameterSpec(new BigInteger("23"), new BigInteger("19"),
new BigInteger("2")));
>         byte[] bytes1 = algorithmParameters.getEncoded(null);
>         byte[] bytes2 = algorithmParameters.getEncoded();
>         assertTrue(Arrays.equals(bytes1, bytes2));
>     }
> RI passes.
> Harmony fails.

-- 
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

        

Mime
View raw message