{"id":8291,"date":"2024-04-24T20:01:01","date_gmt":"2024-04-24T12:01:01","guid":{"rendered":""},"modified":"2024-04-24T20:01:01","modified_gmt":"2024-04-24T12:01:01","slug":"java desede_java.security.InvalidKeyException: Wrong algorithm: DESede or TripleDES required","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8291.html","title":{"rendered":"java desede_java.security.InvalidKeyException: Wrong algorithm: DESede or TripleDES required"},"content":{"rendered":"
I wrote this code, my key is: \"ooWqEPcw7KR\/h\/JIbrFCRHiEVaybvnB2\".<\/p>\n
try<\/p>\n
{
\n <\/p>\n
Base64Decoder base64Decoder=new Base64Decoder();<\/p>\n
String encryptType=\"DESede\/ECB\/PKCS5Padding\";<\/p>\n
String workingKey=\"ooWqEPcw7KR\/h\/JIbrFCRHiEVaybvnB2\";<\/p>\n
SecretKey secretKey=new SecretKeySpec(base64Decoder.decode(workingKey), encryptType);<\/p>\n
Cipher cipher=Cipher.getInstance(encryptType);<\/p>\n
cipher.init(1, secretKey);<\/p>\n
}<\/p>\n
catch(NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e)<\/p>\n
{
\n <\/p>\n
e.printStackTrace();<\/p>\n
}<\/p>\n
But I get this error!!!<\/p>\n
java.security.InvalidKeyException: Wrong algorithm: DESede or TripleDES required<\/p>\n
at com.sun.crypto.provider.DESedeCrypt.init(DESedeCrypt.java:65)<\/p>\n
at com.sun.crypto.provider.ElectronicCodeBook.init(ElectronicCodeBook.java:93)<\/p>\n
at com.sun.crypto.provider.CipherCore.init(CipherCore.java:582)<\/p>\n
at com.sun.crypto.provider.CipherCore.init(CipherCore.java:458)<\/p>\n
at com.sun.crypto.provider.DESedeCipher.engineInit(DESedeCipher.java:166)<\/p>\n
at javax.crypto.Cipher.implInit(Cipher.java:802)<\/p>\n
at javax.crypto.Cipher.chooseProvider(Cipher.java:864)<\/p>\n
at javax.crypto.Cipher.init(Cipher.java:1249)<\/p>\n
at javax.crypto.Cipher.init(Cipher.java:1186)<\/p>\n
at EncryptText.main(EncryptText.java:24)<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"java desede_java.security.InvalidKeyException: Wrong algorithm: DESede or TripleDES requiredIwrotethiscode,mykeyis:\"o...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8291"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8291"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8291\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}