RFR: 8256363: Define toString() for MGF1ParameterSpec [v2]
Sean Mullan
mullan at openjdk.java.net
Mon Nov 16 16:22:04 UTC 2020
On Mon, 16 Nov 2020 14:25:20 GMT, Weijun Wang <weijun at openjdk.org> wrote:
>> Without this method, `PSSParameterSpec::toString` shows something like:
>> MD: SHA-256
>> MGF: java.security.spec.MGF1ParameterSpec at 77b52d12
>> SaltLength: 32
>> TrailerField: 1
>> This is ugly.
>>
>> Noreg-trivial.
>
> Weijun Wang has updated the pull request incrementally with one additional commit since the last revision:
>
> make PSSParameterSpec one line
>
> only in patch2:
> unchanged:
src/java.base/share/classes/java/security/spec/MGF1ParameterSpec.java line 168:
> 166: @Override
> 167: public String toString() {
> 168: return "MGF1:" + mdName;
I would replace "MGF1" or perhaps add "DigestAlgorithm" which is the name of the attribute. Is it necessary to print that this is an MGF1? PSSParameterSpec does not print that it is an RSASSA-PSS-params, and also prints "MGF", so it seems there would be some duplication. It almost seems like we should have some rules regarding how these parameters are printed out so everything is consistent.
Or perhaps it makes sense to have brackets around the fields. Otherwise when you chain several toStrings together, it makes it more difficult to discern when one field ends and the next begins. Hmm.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1208
More information about the security-dev
mailing list