< prev index next >

test/jdk/javax/net/ssl/compatibility/Utils.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 122,144 **** private static PrivateKey createKey(Cert cert) throws NoSuchAlgorithmException, InvalidKeySpecException { PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec( hexToBytes(cert.privKeyMaterials)); KeyFactory keyFactory = KeyFactory.getInstance( ! getKeyAlgorithm(cert.signatureAlgorithm)); PrivateKey privKey = keyFactory.generatePrivate(privKeySpec); return privKey; } - private static String getKeyAlgorithm( - SignatureAlgorithm signatureAlgorithm) { - String signatureAlogrithmName = signatureAlgorithm.name(); - return signatureAlogrithmName.equals(SignatureAlgorithm.ECDSA.name()) - ? "EC" - : signatureAlogrithmName; - } - public static byte[] hexToBytes(String hex) { if (hex == null) { return null; } --- 122,136 ---- private static PrivateKey createKey(Cert cert) throws NoSuchAlgorithmException, InvalidKeySpecException { PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec( hexToBytes(cert.privKeyMaterials)); KeyFactory keyFactory = KeyFactory.getInstance( ! cert.keyAlgorithm.name); PrivateKey privKey = keyFactory.generatePrivate(privKeySpec); return privKey; } public static byte[] hexToBytes(String hex) { if (hex == null) { return null; }
< prev index next >