< prev index next >

test/jdk/sun/security/pkcs11/tls/TestKeyMaterial.java

Print this page
rev 59107 : imported patch security


 140                         new SecretKeySpec(master, "TlsMasterSecret");
 141                     TlsKeyMaterialParameterSpec spec =
 142                         new TlsKeyMaterialParameterSpec(masterKey, major, minor,
 143                         clientRandom, serverRandom, cipherAlgorithm,
 144                         keyLength, expandedKeyLength, ivLength, macLength,
 145                         null, -1, -1);
 146 
 147                     try {
 148                         kg.init(spec);
 149                         TlsKeyMaterialSpec result =
 150                             (TlsKeyMaterialSpec)kg.generateKey();
 151                         match(lineNumber, clientCipherBytes,
 152                             result.getClientCipherKey(), cipherAlgorithm);
 153                         match(lineNumber, serverCipherBytes,
 154                             result.getServerCipherKey(), cipherAlgorithm);
 155                         match(lineNumber, clientIv, result.getClientIv(), "");
 156                         match(lineNumber, serverIv, result.getServerIv(), "");
 157                         match(lineNumber, clientMacBytes, result.getClientMacKey(), "");
 158                         match(lineNumber, serverMacBytes, result.getServerMacKey(), "");
 159                     } catch (InvalidAlgorithmParameterException iape) {
 160                         // SSLv3 support is removed in S12
 161                         if (provider.getName().indexOf("Solaris") != -1) {
 162                             if (major == 3 && minor == 0) {
 163                                 System.out.println("Skip testing SSLv3 on Solaris");
 164                                 continue;
 165                             }
 166                         }
 167                         throw iape;
 168                     } catch (ProviderException pe) {
 169                         if (provider.getName().indexOf("NSS") != -1) {
 170                             Throwable t = pe.getCause();
 171                             if (expandedKeyLength != 0
 172                                     && t.getMessage().indexOf(
 173                                             "CKR_MECHANISM_PARAM_INVALID") != -1) {
 174                                 // NSS removed support for export-grade cipher suites in 3.28,
 175                                 // see https://bugzilla.mozilla.org/show_bug.cgi?id=1252849
 176                                 System.out.println("Ignore known NSS failure on CKR_MECHANISM_PARAM_INVALID");
 177                                 continue;
 178                             }
 179                         }
 180                         throw pe;
 181                     }
 182                } else {
 183                     throw new Exception("Unknown line: " + line);
 184                }
 185             }
 186             if (n == 0) {




 140                         new SecretKeySpec(master, "TlsMasterSecret");
 141                     TlsKeyMaterialParameterSpec spec =
 142                         new TlsKeyMaterialParameterSpec(masterKey, major, minor,
 143                         clientRandom, serverRandom, cipherAlgorithm,
 144                         keyLength, expandedKeyLength, ivLength, macLength,
 145                         null, -1, -1);
 146 
 147                     try {
 148                         kg.init(spec);
 149                         TlsKeyMaterialSpec result =
 150                             (TlsKeyMaterialSpec)kg.generateKey();
 151                         match(lineNumber, clientCipherBytes,
 152                             result.getClientCipherKey(), cipherAlgorithm);
 153                         match(lineNumber, serverCipherBytes,
 154                             result.getServerCipherKey(), cipherAlgorithm);
 155                         match(lineNumber, clientIv, result.getClientIv(), "");
 156                         match(lineNumber, serverIv, result.getServerIv(), "");
 157                         match(lineNumber, clientMacBytes, result.getClientMacKey(), "");
 158                         match(lineNumber, serverMacBytes, result.getServerMacKey(), "");
 159                     } catch (InvalidAlgorithmParameterException iape) {







 160                         throw iape;
 161                     } catch (ProviderException pe) {
 162                         if (provider.getName().indexOf("NSS") != -1) {
 163                             Throwable t = pe.getCause();
 164                             if (expandedKeyLength != 0
 165                                     && t.getMessage().indexOf(
 166                                             "CKR_MECHANISM_PARAM_INVALID") != -1) {
 167                                 // NSS removed support for export-grade cipher suites in 3.28,
 168                                 // see https://bugzilla.mozilla.org/show_bug.cgi?id=1252849
 169                                 System.out.println("Ignore known NSS failure on CKR_MECHANISM_PARAM_INVALID");
 170                                 continue;
 171                             }
 172                         }
 173                         throw pe;
 174                     }
 175                } else {
 176                     throw new Exception("Unknown line: " + line);
 177                }
 178             }
 179             if (n == 0) {


< prev index next >