269 // Used in javax.security.auth.kerberos.KeyImpl |
269 // Used in javax.security.auth.kerberos.KeyImpl |
270 public EncryptionKey(char[] password, |
270 public EncryptionKey(char[] password, |
271 String salt, |
271 String salt, |
272 String algorithm) throws KrbCryptoException { |
272 String algorithm) throws KrbCryptoException { |
273 |
273 |
274 if (algorithm == null || algorithm.equalsIgnoreCase("DES")) { |
274 if (algorithm == null || algorithm.equalsIgnoreCase("DES") |
|
275 || algorithm.equalsIgnoreCase("des-cbc-md5")) { |
275 keyType = EncryptedData.ETYPE_DES_CBC_MD5; |
276 keyType = EncryptedData.ETYPE_DES_CBC_MD5; |
276 } else if (algorithm.equalsIgnoreCase("DESede")) { |
277 } else if (algorithm.equalsIgnoreCase("des-cbc-crc")) { |
|
278 keyType = EncryptedData.ETYPE_DES_CBC_CRC; |
|
279 } else if (algorithm.equalsIgnoreCase("DESede") |
|
280 || algorithm.equalsIgnoreCase("des3-cbc-sha1-kd")) { |
277 keyType = EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD; |
281 keyType = EncryptedData.ETYPE_DES3_CBC_HMAC_SHA1_KD; |
278 } else if (algorithm.equalsIgnoreCase("AES128")) { |
282 } else if (algorithm.equalsIgnoreCase("AES128") |
|
283 || algorithm.equalsIgnoreCase("aes128-cts-hmac-sha1-96")) { |
279 keyType = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96; |
284 keyType = EncryptedData.ETYPE_AES128_CTS_HMAC_SHA1_96; |
280 } else if (algorithm.equalsIgnoreCase("ArcFourHmac")) { |
285 } else if (algorithm.equalsIgnoreCase("ArcFourHmac") |
|
286 || algorithm.equalsIgnoreCase("rc4-hmac")) { |
281 keyType = EncryptedData.ETYPE_ARCFOUR_HMAC; |
287 keyType = EncryptedData.ETYPE_ARCFOUR_HMAC; |
282 } else if (algorithm.equalsIgnoreCase("AES256")) { |
288 } else if (algorithm.equalsIgnoreCase("AES256") |
|
289 || algorithm.equalsIgnoreCase("aes256-cts-hmac-sha1-96")) { |
283 keyType = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96; |
290 keyType = EncryptedData.ETYPE_AES256_CTS_HMAC_SHA1_96; |
284 // validate if AES256 is enabled |
291 // validate if AES256 is enabled |
285 if (!EType.isSupported(keyType)) { |
292 if (!EType.isSupported(keyType)) { |
286 throw new IllegalArgumentException("Algorithm " + algorithm + |
293 throw new IllegalArgumentException("Algorithm " + algorithm + |
287 " not enabled"); |
294 " not enabled"); |