RFR: 8256363: Define toString() for MGF1ParameterSpec [v2]

Weijun Wang weijun at openjdk.java.net
Tue Nov 17 15:31:05 UTC 2020


On Mon, 16 Nov 2020 22:04:21 GMT, Sean Mullan <mullan at openjdk.org> wrote:

>> I like the 2nd one better, but I'll see how Sean thinks about the verbose record-style toString.
>
> 99% of the time, it will probably be one of the MGF1ParameterSpec constants. For those, perhaps it would be nice to just use the constant: "MGF: MGF1ParameterSpec.SHA1" and for anything else, "MGF: MGF1ParameterSpec [digestAlgorithm: ...>". If this is too complicated, then I am ok with the above.

This is doable and probably will be fast if I just keep checking `if (this == MGF1ParameterSpec.SHA1) return "MGF1ParameterSpec.SHA1"` but the code will be quite long. There are 11 constants. Maybe if this class were an enumeration...

-------------

PR: https://git.openjdk.java.net/jdk/pull/1208


More information about the security-dev mailing list