How can I decrypt data that was PL / SQL encrypted (using JavaServerPages) Pre> The key is known. I am new to JSP then explain your answer. After the this encryption method Prerequisite: This code is a library org.apache. Uses commons. Download codec.binary, org.apache.commons.codec.binary 1.5 binary file and put it in the lib folder This should probably solve your problem. Cheers! Dbms_obfuscation_toolkit.DESEncrypt
dbms_obfuscation_toolkit.DESEncrypt allows you to keep the password or You only call strings in many of the 8 characters. So below I have a sample JSP page which shows that a string is encrypted and decrypted.
. & Lt;% @ page import = "java.io. *"% & gt; & Lt;% @ page import = "java.security. *"% & Gt; & Lt;% @ Page Import = "javax.crypto. *"% <% & Gt; & Lt;% @ Page Import = "javax.crypto.spec. *"% "% & Gt; & Lt;% @ page import = "java.lang. *"% & Gt; & Lt;% @ Page Import = "org.apache.commons.codec.binary. *"% " & Lt; Html & gt; & Lt; HEAD & gt; & Lt; Title & gt; Cheers! & Lt; / Title & gt; & Lt; / HEAD> & Lt; Body & gt; & Lt;% string algorithm1 = "des"; // Magical Mystery Continuous String Algorithm2 = "DES / CBC / NoPadding"; // Magical mystery continuously IvParameterSpec iv = new IvParameterSpec (new byte [] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}); // magical mystery constant cipher cipher; Secret key; String k = "12345abc"; // Just pick a random for the test key = new secrecy some SPEC (KAT Bites ("UTF-8"), algorithm 1); Cipher = cipher Get Instances (Algorithm 2); String str = "test4abc"; // test string, 8 letter cipher. It (cipher ncryvp_modie, key, iv); // Normally you can leave the IvParameterSpec logic out, but not with Oracle byte [] bytes = str.getBytes ("UTF-8"); Byte [] Encrypted = Cipher Final (bytes); String encoded = new string (hex. Encodehex (encrypted)); Out.println ("Encrypted / Encoded: \" "+ + Encoded +" \ ""); Cipher.init (cipher .DERCP_MODEG, key, iv); // byte [] decoded = org.apache.commons.codec.binary.Hex.decodeHex (encoded.cool ()); Byte [] decoded = hex Decodhex (encoded. Coachere ()); String decrypted = new string (cipher .donode); Out.println ("decrypted: \" "+ decrypted +" \ ""); }% & Gt; & Lt; / Body & gt; & Lt; / Html & gt;
Comments
Post a Comment