Mercurial > hg > release > icedtea-web-1.7
changeset 1485:f136f53d661c
netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java: fixed hex output of certificate signature for jdk8
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Mon, 10 Sep 2018 17:37:30 +0200 |
parents | cd94fb214752 |
children | 28e58481df58 |
files | ChangeLog netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java |
diffstat | 2 files changed, 20 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Sep 10 17:36:21 2018 +0200 +++ b/ChangeLog Mon Sep 10 17:37:30 2018 +0200 @@ -1,3 +1,8 @@ +2018-06-20 Jiri Vanek <jvanek@redhat.com> + + * netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java: fixed hex output of certificate signature + for jdk8 + 2018-06-20 Jiri Vanek <jvanek@redhat.com> Added semi support for recognition jdk10 and up
--- a/netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java Mon Sep 10 17:36:21 2018 +0200 +++ b/netx/net/sourceforge/jnlp/security/dialogs/CertsInfoPane.java Mon Sep 10 17:37:30 2018 +0200 @@ -185,25 +185,28 @@ return jdkIndependentHexEncoderImpl(signature); } catch (Exception ex) { String s = "Failed to encode signature: " + ex.toString(); - OutputController.getLogger().log(s); + OutputController.getLogger().log(OutputController.Level.WARNING_ALL, s); + OutputController.getLogger().log(ex); return s; } } private String jdkIndependentHexEncoderImpl(byte[] signature) throws Exception { - // jdk8 is using sun.misc.HexDumpEncoder, - // jdk9 is using sun.security.util.HexDumpEncoder - Class clazz; try { - clazz = Class.forName("sun.security.util.HexDumpEncoder"); - } catch (ClassNotFoundException ex) { - OutputController.getLogger().log("Using jdk8's HexDumpEncoder"); - clazz = Class.forName("sun.misc.HexDumpEncoder"); + OutputController.getLogger().log("trying jdk9's HexDumpEncoder"); + Class clazz = Class.forName("sun.security.util.HexDumpEncoder"); + Object encoder = clazz.newInstance(); + Method m = clazz.getDeclaredMethod("encodeBuffer", byte[].class); + //convert our signature into a nice human-readable form. + return (String) m.invoke(encoder, signature); + } catch (Exception ex) { + OutputController.getLogger().log("trying jdk8's HexDumpEncoder"); + Class clazz = Class.forName("sun.misc.HexDumpEncoder"); + Object encoder = clazz.newInstance(); + Method m = clazz.getMethod("encode", byte[].class); + //convert our signature into a nice human-readable form. + return (String) m.invoke(encoder, signature); } - Object encoder = clazz.newInstance(); - Method m = clazz.getDeclaredMethod("encodeBuffer", byte[].class); - //convert our signature into a nice human-readable form. - return (String) m.invoke(encoder, signature); } /**