|
51 | 51 | import javax.crypto.spec.PBEKeySpec; |
52 | 52 | import javax.crypto.spec.SecretKeySpec; |
53 | 53 |
|
| 54 | +import org.apache.juli.logging.Log; |
| 55 | +import org.apache.juli.logging.LogFactory; |
54 | 56 | import org.apache.tomcat.util.buf.Asn1Parser; |
55 | 57 | import org.apache.tomcat.util.buf.Asn1Writer; |
56 | 58 | import org.apache.tomcat.util.buf.HexUtils; |
|
64 | 66 | */ |
65 | 67 | public class PEMFile { |
66 | 68 |
|
| 69 | + private static final Log log = LogFactory.getLog(PEMFile.class); |
67 | 70 | private static final StringManager sm = StringManager.getManager(PEMFile.class); |
68 | 71 |
|
69 | 72 | private static final byte[] OID_EC_PUBLIC_KEY = |
@@ -370,18 +373,21 @@ public PrivateKey toPrivateKey(String password, String keyAlgorithm, Format form |
370 | 373 | secretKeyAlgorithm = "DES"; |
371 | 374 | cipherTransformation = "DES/CBC/PKCS5Padding"; |
372 | 375 | keyLength = 8; |
| 376 | + log.error(sm.getString("pemFile.encryption.broken", filename, algorithm)); |
373 | 377 | break; |
374 | 378 | } |
375 | 379 | case "DES-EDE3-CBC": { |
376 | 380 | secretKeyAlgorithm = "DESede"; |
377 | 381 | cipherTransformation = "DESede/CBC/PKCS5Padding"; |
378 | 382 | keyLength = 24; |
| 383 | + log.warn(sm.getString("pemFile.encryption.insecure", filename, algorithm)); |
379 | 384 | break; |
380 | 385 | } |
381 | 386 | case "AES-256-CBC": { |
382 | 387 | secretKeyAlgorithm = "AES"; |
383 | 388 | cipherTransformation = "AES/CBC/PKCS5Padding"; |
384 | 389 | keyLength = 32; |
| 390 | + log.warn(sm.getString("pemFile.encryption.insecure", filename, algorithm)); |
385 | 391 | break; |
386 | 392 | } |
387 | 393 | default: |
@@ -501,6 +507,7 @@ public PrivateKey toPrivateKey(String password, String keyAlgorithm, Format form |
501 | 507 | throw new NoSuchAlgorithmException( |
502 | 508 | sm.getString("pemFile.unknownEncryptionAlgorithm", toDottedOidString(oidCipher))); |
503 | 509 | } |
| 510 | + log.warn(sm.getString("pemFile.encryption.insecure", filename, algorithm)); |
504 | 511 |
|
505 | 512 | byte[] iv = p.parseOctetString(); |
506 | 513 |
|
|
0 commit comments