Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Metadata
ID:java-security/no-des-cipher
Language: Java
Severity: Error
Category: Security
Description
DES is considered strong ciphers for modern applications. NIST recommends the usage of AES block ciphers instead of DES.
classMyClass{publicvoidtest1(){Cipherc=Cipher.getInstance("DES/ECB/PKCS5Padding");c.init(Cipher.ENCRYPT_MODE,k,iv);byte[]cipherText=c.doFinal(plainText);}publicvoidtest2(){Cipherc=Cipher.getInstance("DESede/ECB/PKCS5Padding");c.init(Cipher.ENCRYPT_MODE,k,iv);byte[]cipherText=c.doFinal(plainText);}publicvoidtest3(){javax.crypto.Cipherc=javax.crypto.Cipher.getInstance("DES/ECB/PKCS5Padding");// Prepare the cipher to encryptjavax.crypto.SecretKeykey=javax.crypto.KeyGenerator.getInstance("DES").generateKey();java.security.spec.AlgorithmParameterSpecparamSpec=newjavax.crypto.spec.IvParameterSpec(iv);c.init(javax.crypto.Cipher.ENCRYPT_MODE,key,paramSpec);}}