RFR: 8210838: Override javax.crypto.Cipher.toString()

Weijun Wang weijun.wang at oracle.com
Fri Nov 16 14:19:37 UTC 2018


Do you want to update the init() methods to make use of this new toString() output? This avoids duplicated code and we can even inline the getOpmodeString() method.

--Max

> On Nov 16, 2018, at 10:04 PM, Seán Coffey <sean.coffey at oracle.com> wrote:
> 
> That's a good example and point Max. How does this revision look ?
> 
> http://cr.openjdk.java.net/~coffeys/webrev.8210838.v2/webrev/
> 
> Regards,
> Sean.
> 
> On 16/11/18 03:35, Weijun Wang wrote:
>> Signature's toString looks like
>> 
>> public String toString() {
>>     String initState = "";
>>     switch (state) {
>>     case UNINITIALIZED:
>>         initState = "<not initialized>";
>>         break;
>>     case VERIFY:
>>         initState = "<initialized for verifying>";
>>         break;
>>     case SIGN:
>>         initState = "<initialized for signing>";
>>         break;
>>     }
>>     return "Signature object: " + getAlgorithm() + initState;
>> }
>> 
>> Maybe you can add some similar info.
>> 
>> In fact, it looks like you can extract the debug output at the end of each init() methods into a new toString() method.
>> 
>> Thanks
>> Max
>> 
>>> On Nov 16, 2018, at 12:35 AM, Seán Coffey <sean.coffey at oracle.com> wrote:
>>> 
>>> A simple enhancement to override toString() for javax.crypto.Cipher class
>>> 
>>> https://bugs.openjdk.java.net/browse/JDK-8210838
>>> webrev : http://cr.openjdk.java.net/~coffeys/webrev.8210838/webrev/
>>> 
>>> regards,
>>> Sean.
>>> 
> 




More information about the security-dev mailing list