java.security.InvalidKeyException:Elgamal
I am trying to encrypt and decrypt Elgaman but I am getting error of
Erick: Exception: java.security.InvalidKeyException: illegal for size or default parametersjava.security.InvalidKeyException: illegal for size or default parameters
at javax.crypto.Cipher.a(DashoA13*..)
at javax.crypto.Cipher.init(DashoA13*..)
at org.students.RSA2.testGP(RSA2.java:71)
at org.students.RSA2.performTest(RSA2.java:277)
at org.bouncycastle.util.test.SimpleTest.perform (unknown Source)
at org.bouncycastle.util.test.SimpleTest.runTest (unknown Source)
at org.bouncycastle.util.test.SimpleTest.runTest (unknown Source)
at org.students.RSA2.main(RSA2.java:291)
i installed the JDK 5.0 Update 22 and download the jce from
http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html and installed in
C:\Program Files\Java\jdk1.5.0_22\jre\lib\security
but It give me same error .Please help me. Thanks in advance
Edited by: user11357554 on Apr 17, 2011 2:06 PM
Edited by: EJP on 18/04/2011 11:41: added code tags. Please use them.
Edited by: user11357554 on Apr 22, 2011 9:47 AM
user11357554 wrote:
I installed the JDK 5.0 Update 22 and download the jce to
http://www.Oracle.com/technetwork/Java/javase/downloads/index-JDK5-JSP-142662.html and installed in the
C:\Program Files\Java\jdk1.5.0_22\jre\lib\security
I don't think you can have followed installation instructions "unlimited strength". You must decompress the unlimited 'force' file and copy the contents of the subdirectory of PvE is directly in the C:\Program Files\Java\jdk1.5.0_22\jre\lib\security directory.
PS why are you using JDK1.5?
PS - 1. When you convert a string to/from bytes ALWAYS specify the character encoding as the default character encoding is probably very different for different OS, OS variants, and variants of Java.
PS - 2. Never use string as a container for the binary data and ciphertext IS binary data.
Tags: Java
Similar Questions
-
java.security.InvalidKeyException: illegal key size
Hello
I developed an application of adf using jdeveloper 11g how weblogic 10.3.3.0 hosts.
My adf application must connect to an external application for credit card validation.
To do this, I use a HTTPURLConnection and passing the external address and attributes that must be written into it.
The external application that I am trying to connect is secure starts with https://...
I get an error as soon I try to open the "connection.getOutputStream ()".
Here is the error I get
Here is the code I use to connect to the external Web site.<Oct 8, 2010 10:32:54 AM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=T-TeleSec GlobalRoot Class 3,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.> <Oct 8, 2010 10:32:54 AM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=T-TeleSec GlobalRoot Class 2,OU=T-Systems Trust Center,O=T-Systems Enterprise Services GmbH,C=DE". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.> <Oct 8, 2010 10:32:54 AM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=GlobalSign,O=GlobalSign,OU=GlobalSign Root CA - R3". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.> <Oct 8, 2010 10:32:54 AM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "OU=Security Communication RootCA2,O=SECOM Trust Systems CO.\,LTD.,C=JP". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.> <Oct 8, 2010 10:32:54 AM CDT> <Notice> <Security> <BEA-090898> <Ignoring the trusted CA certificate "CN=KEYNECTIS ROOT CA,OU=ROOT,O=KEYNECTIS,C=FR". The loading of the trusted certificate list raised a certificate parsing exception PKIX: Unsupported OID in the AlgorithmIdentifier object: 1.2.840.113549.1.1.11.> java.security.InvalidKeyException: Illegal key size at javax.crypto.Cipher.a(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) at javax.crypto.Cipher.init(DashoA13*..) at com.certicom.tls.provider.Cipher.init(Unknown Source) at com.certicom.tls.ciphersuite.SecurityParameters.createWriteCipher(Unknown Source) at com.certicom.tls.record.handshake.HandshakeHandler.changeCipherSpec(Unknown Source) at com.certicom.tls.record.handshake.ClientStateReceivedCertificate.handle(Unknown Source) at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown Source) at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source) at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown Source) at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Source) at com.certicom.tls.record.ReadHandler.processRecord(Unknown Source) at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source) at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source) at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source) at com.certicom.tls.record.WriteHandler.write(Unknown Source) at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:124)
I am currently totally distraught, I don't understand what measures should I take. Is this error due to keystore stuff?URL url; HttpURLConnection connection = null; try { //Create connection url = new URL(targetURL); connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length)); connection.setRequestProperty("Content-Language", "en-US"); connection.setUseCaches (false); connection.setDoOutput(true); DataOutputStream wr = new DataOutputStream ( connection.getOutputStream ()); wr.writeBytes (urlParameters); wr.flush (); wr.close (); //Get Response InputStream is = connection.getInputStream(); System.out.println("after getting input stream"); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); System.out.println("after BUffered reader"); String line; StringBuffer response = new StringBuffer(); System.out.println("after String buffer"); while((line = rd.readLine()) != null) { response.append(line); response.append('\r'); } rd.close(); return response.toString(); } catch (Exception e) { e.printStackTrace(); return null; } finally { if(connection != null) { connection.disconnect(); } } }
I even tried to replace policy files in jre according to some articles, but it still does not work.
I have very limited knowledge of the security issues with weblogic, I really will appreciate if I can get all the links or any help in this matter.
Thanks in advance
AshYou might find this useful
http://WebLogic-wonders.com/WebLogic/2010/01/28/troubleshooting-SSL-issues/
-
Java security warning makes v19 and v20 firefox crashing
After the security warning popup windows is indicated, if I do nothing for 2-3 seconds, firefox crashes.
Hello
Thanks for your suggestion.The problem has been resolved by forcing the developer to the page to remove the annoying Java security warning.
After removing the Java window, firefox crashes is no longer.
Firefox update action is not necessary.See you soon.
-
java.security.AccessControlException on the socket connection
Hi all
I'm java.security.AccessControlException on open socket connection, I added permissions API, looks like I missed something.
SocketConnection sc = null;
try {}
SC = (SocketConnection)
Connector.Open ("socket://10.91.40.120:1883"); ")
} catch (IOException ex) {}
Logger.getLogger (NetworkAPI.class.getName ()) .log (Level.SEVERE, null, ex);
}
Hello
You need javax.microedition.io.SocketProtocolPermission to access socket connection.
Please add the following permissions to the project:
-client connection: javax.microedition.io.SocketProtocolPermission "socket / / *: *:
-Server connection javax.microedition.io.SocketProtocolPermission "socket / /: *:
Concerning
Alexey
-
Bundle Native Bird java.security.NoSuchAlgorithmException
I am trying to build a native bundle, especially for mac os x, but also in windows. And in both environments the .app, .dmg, .exe download generated correctly, but when I run it, I get a lot of exceptions java.security.NoSuchAlgorithmException. For example:
Caused by: java.security.NoSuchAlgorithmException: SunTlsRsaPremasterSecret not available KeyGenerator
Caused by: java.security.NoSuchAlgorithmException: SecretKeyFactory PBEWithMD5AndDES unavailable
My program uses security TLS connections in xmpp. And I also have a webview with HTTPS which does not load eighter.
Does anyone have any idea why this might be happening?
I acknowledge that if I run the generated only jar, it in works very well, it only happens with the .exe and. app.
It's my build.xml fx: deploy code:
"< fx: deploy width =" ${javafx.run.width} "height =" ${javafx.run.height} ".
nativeBundles = "all".
OutDir = "${basedir} / ${dist.dir} ' outfile =" ${application.title} ">"
< fx:application name = "${application.title}" "
mainClass="${javafx.main.class}"/ >
< fx:resources >
< fx:fileset dir = "${basedir} / ${dist.dir} '"
includes = "*.jar" / >
< fx:fileset dir = "${basedir} / ${dist.dir}" includes="lib/*.jar"/ > "
< / fx:resources >
< fx:info title = "${application.title}" "
Vendor = "${application." Vendor} "/ >"
< / fx: deployment >
Appreciate your help.
Published by: ascuccimarra on February 20, 2013 13:36This solution might work for you.
http://StackOverflow.com/questions/13356633/JavaFX-WebView-not-loading-HTTPS-page/13599131#13599131 -
MD5. DBMS_CRYPTO. Hash vs java.security.MessageDigest
Hello
I have xml in a CLOB column.
I want to get MD5 with DBMS_CRYPTO. Hash:
(Oracle Database 10g Enterprise Edition Release 10.2.0.5.0)
I need get MD5 even with java.security.MessageDigest.SET SERVEROUTPUT ON DECLARE vXml_ CLOB; tam NUMBER; l_hash raw(2000); l_hashCa varchar2(2000); BEGIN SELECT COL, dbms_lob.getlength(COL) AS TAMA INTO vXml_, tam FROM BORRAME WHERE ID = 1; l_hash := DBMS_CRYPTO.Hash ( vXml_, DBMS_CRYPTO.HASH_MD5); l_hashCa := lower(rawtohex(l_hash)); dbms_output.put_line('Size: ' || tam); dbms_output.put_line('Hash: ' || l_hash); dbms_output.put_line('Hash-1: ' || l_hashCa); END; / Size: 9902 Hash: 36D0C059092B450C0598EBFECC015FF5 Hash-1: 36d0c059092b450c0598ebfecc015ff5
Create
SET def off create or replace java source named "MD5" as import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.Clob; import java.sql.Blob; public class MD5 { public static String getMD5HashFromClob(Clob inhalt) throws Exception{ MessageDigest algorithm; StringBuffer hexString; String s; String salida = null; int i; byte[] digest; String tepFordigest = inhalt.getSubString(1L, (int)inhalt.length()); try { algorithm = MessageDigest.getInstance("MD5"); algorithm.reset(); algorithm.update(tepFordigest.getBytes()); digest = algorithm.digest(); hexString = new StringBuffer(); for (i = 0; i < digest.length; i++) { s = "0" + Integer.toHexString(0xFF & digest);
hexString.append(s.substring(s.length() - 2));
}
salida = hexString.toString();
} catch (java.security.NoSuchAlgorithmException nsae) {
salida = "No es posible cifrar MD5";
}
return salida;
}
}
/
sho err
alter java source "MD5" compile
/
sho err
CREATE OR REPLACE FUNCTION get_md5_CLOB(inhalt CLOB) RETURN VARCHAR2 DETERMINISTIC
AS LANGUAGE JAVA
name 'MD5.getMD5HashFromClob(java.sql.Clob) return java.lang.String';
/
SET SERVEROUTPUT ONNow, i use:
DECLARE
vXml_ CLOB.
TAM NUMBER;
l_hash raw (2000);
l_hashCa varchar2 (2000);
BEGIN
SELECT COL, dbms_lob.getlength (COL) AS TAMA
IN vXml_, tam
OF BORRAME
WHERE ID = 1;
l_hash: = get_md5_CLOB (vXml_);
l_hashCa: = lower (rawtohex (l_hash));
dbms_output.put_line (' size: ': tam);
dbms_output.put_line ('Hash: ' | l_hash);
dbms_output.put_line ('Hash-1: ' | l_hashCa);
END;
/
Size: 9902
Hash: 77E252BC18244BEDDE13072BC3918DBF
Hash-1: 77e252bc18244bedde13072bc3918dbfWhy are they different???: 36d0c059092b450c0598ebfecc015ff5 77e252bc18244bedde13072bc3918dbf
>
Can you think of another mistake?
>
Not an error but the character set used by Java (UTF-16) may be different. The Crypto package always converts all AL32UTF8 before you chop it up, so if the Java character set is different the hash may be different.If you look at the technical header for DBMS_CRYPTO package it shows it's not:
>
-Front of encryption, hashing or hashing key, the CLOB data type is
-AL32UTF8 converted. This allows cryptographic data
-transferred and between different databases
-Character between the character set change sets, and
-separate processes (for example, Java programs).
-- -
java.security.AccessControlException:access denied
Hello
I'm going to oracle10g forms.i have created the dialog box browse file using java beans. Code Java itself works fine.i could able to browse a file and open it.but when I try to call from forms the following exception has occurred.
denied java.security.AccessControlException:access (java.io.FilePermission C:\arul\temp\Photos read).
I installed YPI. so my path of the java folder is
C:\Program Files\Java\jdk1.5.0_10
I put the java jar file in the java folder forms and under directory ext jdk.
I was running the form locally using OC4j.
I changed the java policy file in the location following (bold lines).
C:\Program Files\Java\jdk1.5.0_10\jre\lib\security
Standard extensions gets all the default permissions
give the code "file:${{java.ext.dirs}}/*" {}
permission java.security.AllPermission;
};
default permissions granted to all areas
grant {}
Allows any thread stop itself using the Java.lang.Thread.Stop
a method that takes no arguments.
Note that this permission is granted by default only to stay
backward compatible.
It is strongly recommended that you either withdraw this permission
This policy of the file or it further limit sources of code
you specify because Thread.stop () is potentially dangerous.
See 'http://java.sun.com/notes' for more information.
permission java.lang.RuntimePermission "stopThread;
allows anyone listening on unprivileged ports
java.net.SocketPermission permission "localhost:1024 -", "listen";
properies 'standards' that can be read by anyone
* permission java.io.FilePermission "C:\\arul\\temp\\Photos\\*", "read, write"; **
* permission java.io.FilePermission "${user.home} ${/} *", "read"; **
permission java.util.PropertyPermission "java.version", "read";
permission java.util.PropertyPermission "java.vendor", "read";
permission java.util.PropertyPermission "java.vendor.url", "read";
permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
permission java.util.PropertyPermission "file.separator", "read";
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";
permission java.util.PropertyPermission "java.specification.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";
permission java.util.PropertyPermission "java.vm.specification.version", "read";
permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
permission java.util.PropertyPermission "java.vm.specification.name", "read";
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
};
Could someone help how to fix this problem? If I need to change the policy file of java or any file of client policy?
Thank you
Jean EloHere is my makecert.bat:
off @echo
REM ******************************************************************
REM * This script generates a self signed certificate for
REM * JAR files using the settings defined in the signer.properties
REM * file
REM * This script must be run once to create the certificate
REM * the certificate will be valid for 360 days
REM ******************************************************************
REM * DRMILLS June 18, 2003 - creation
REM ******************************************************************for /F "eol = # tokens = 1, 2 * delims ==" %%d set in (signer.properties) %% I = %% j
"c:\DevSuiteHome_1\jdk\bin\keytool" - genkey - dname "cn = Degrelle, OU = development, o = Oracle, c = EN' - alias fdegrelle - keypass fdegrelle - keystore"C:\Program Files\Java\jre1.6.0_03\lib\security\keystore"- storepass jinitiator-validity 360
@echo created certificate...And my sign.bat
CLS
off @echo
REM ******************************************************************
REM * This script sign a jar file using the certificate
REM * defined in the signer.properties file
REM *.
REM * This script can be executed as often it takes on any container
REM * a backup copy of the jar file is created
REM ******************************************************************
REM * DRMILLS June 18, 2003 - creation
REM *******************************for /F "eol = # tokens = 1, 2 * delims ==" %%d set in (signer.properties) %% I = %% j
copy/y %1 %1.unsigned
@echo we
"c:\DevSuiteHome_1\jdk\bin\jarsigner" - keystore "C:\Program Files\Java\jre1.6.0_03\lib\security\keystore" - storepass jinitiator - keypass fdegrelle %1 fdegrelle
@echo signature complete...François
-
accept guests of Java security in Firefox on non-persistent desktops view
Hi all
Here's our environment...
1. view 6.1
2. a pool Nopersistent offices Windows 7 Enterprise
3 Java 32 bits version 8 day 72
4 Firefox 34.0.5
Run us a Java Application (banner) and when you fire in Firefox it shows 2 application prompt, both applications are trusted publishers is not a matter of trust. Because they are non-persistent desktops that our end users bring each time that they restart it. Whats odd is that we have been able to ignore these warnings with IE using strategies of group two, one to be saved in the "trusted publishers" request certificates store and another to add the URL of the application to IE Trusted Sites. I'm not sure how to work around this problem in Firefox
I enable the Java Console and turned on a high level of forest exploitation, and when I got one of these application guests I clicked on the option "don't show this new editor applications and the location above. When I did that the Java console displays the following...
Security: the user granted the privileges to the code forever
Security: deployment of C:\Users\deptsfs\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs loading certificates
Security: responsible for deployment from C:\Users\deptsfs\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs certificates
Security: registration of certificates of deployment in C:\Users\deptsfs\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs
Security: safe deployment in C:\Users\deptsfs\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs certificates
I know I'm grabbing at straws here but y at - he called a way to manipulate the contents of the file "trusted.certs" to the user with a logon script via group policy so that Publisher/App/location is always approved?
Thank you
So... my grad last idea is to deploy the trusted.certs file in the default profile on your master image and test to see if this file is available in-house for new users. Do you know how to copy a user profile in the default user profile in Windows 7?
-
DreamWeaver CS5.5 Java security
How to upgrade Java DreamWeaver CS5.5 on 64-bit Windows7? Can I manually remove files from JAVA C:\Program Files (x 86) \Adobe\Adobe Dreamweaver CS5.5\JDK and C:\Program Files (x 86) \Adobe\Adobe Dreamweaver CS5.5\JVM? These are huge security issues.
The Dreamweaver application uses these files for the operation of the program, they are not the version of Java used by your browser. This version is stored elsewhere on your system. It is possible for applications to need different versions of Java to run and to simultaneously run multiple versions. If you are worried about the version that runs, you could update DW to the latest version. 4 releases in DW have been since the era where CS 5.5 was released.
-
Pot of icons of the 11g Java security concern
Hello
I created a jar containing my incos app and I had signed with the help of script sign_webutil.sh and he added to the setting of archive on the web configuration file, but each time users access the application a warning: 'Java discovered application components that could indicate a security problem.
User who can I use to sign the file in unix? can I copy or add the .keystore file generate in any place?
Thanks in advance
HernanSee the following note to MyOracleSupport for more information:
+ (Doc ID 1081755.1) 'Java has discovered application components that could indicate a security problem' warning with jre 1.6 update 19 ++
-
I worry because I get a shortcut on the desktop called hs_err_pid4 or _pid5.
It looks like a virus, but I'm not sure what the hell's going on? Can you help me?
Hi Raebud,
1. you remember to make changes to your computer before the problem?
Follow these steps and check if the problem persists.
Step 1:
I suggest that you uninstall the old version of Java and install the latest version and check if the problem persists.
Please follow the steps in this article and see if the problem still occurs.
http://www.Java.com/en/download/FAQ/OEM.XML
Step 2:
If you think that the problem is related to viral attacks, I wish you launch a full scan using the Microsoft Safety Scanner and check if the problem persists.
-
What is the equivalent of AESKey in Java EE?
Currently, I am using this code to encrypt
private static ubyte [] encrypt (byte [] encryptionKey, byte [] plaintext) throws Exception {}
Encryption cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
Key SecretKeySpec = new SecretKeySpec (encryptionKey, "AES");
Byte [] x is Cipher.init (Cipher.ENCRYPT_MODE, Key);.Return cipher.doFinal (x);
}and it returns java.security.InvalidKeyException: not valid AES key length:... bytes
Well, SecretKeySpec key = new SecretKeySpec (encryptionKey, "AES"); is the same as AESKey
It was just restriction of encrypting Java that restrict only 128-bit key length, but RIM does not restrict the length of key in his crypto AES API...
-
Signatory of bar - Debug tokens, create fails, import does nothing
In Eclipse, Preferences, BlackBerry, BlackBerry SDK tools, Bar signatory both create and import fail (in a slightly different way). It comes with the new tools of 1.3 released this week.
Create has always been broken (for me both v1.2 and 1.3 tools), where it still shows the certificate of loading error: java.io.IOException: key topic, java.security.InvalidKeyException: invalid key CE.
Advice on another forum entry, work-arround is to manually create a debugging token using the blackberry-debugtokenrequest tool. This process with an import, worked under Tools v1.2 (at least once). Now with a new device I created a new token of debugging with the new device ID and he gave a new file name. When I try to import into. I get the 'in progress' for about 5 seconds operation"and then the dialog box disappears and information has NOT been added to the list of tokens of Debug (so I can't download the token).
During the process, I have only the new attached device (a Dev B device with active debugging). I use Windows 7 x 64 SP1 with Eclipse SP2 Indigo and BlackBerry taken into 1.3.0.201209131728, Java 7 update 7. I have all the latest update in Eclipse. Another note, during an attempt to create, it automatically detect the device and shows the right PIN device if you can see the device.
Any ideas?
Good idea. I couldn't find any 32-bit command-line tools, but I just copied the files in the 64-bit directory in a folder in the "Program files (x 86)" assumming they run in both modes. I managed, but I don't know if the "32-bit" operation makes no difference. I came across the same problem as before, but I understand an alternative that worked as follows. It is a different process as described in the documentation.
Start with a token created debug created via the command line utility (blackberry-debugtokenrequest) for your specific device (in my case, a Dev Alpha B). Have the device connected via the USB port and within the parameters of the device, secuity, Mode of development.
In the Eclipse-> BlackBerry preferences-> BlackBerry tools-> target. The (default) usb item should appear in the list. Select it and then press the button of Details Token debug, and then select Import. Point to the file debug token you already created. Once completed, he must invite to download the token to the device, I did. Success at last!
-
Unsupported key type: DSA Sun public key
Hi all
Does anyone know how to use the algorithm of SHA1withDSA with WSS4J/axis?
When you use a private key generated by the keytool with type DSA utility, I get errors:
org.apache.ws.security.WSSecurityException: cannot encrypt data
Caused by: java.security.InvalidKeyException: unsupported key type: Sun DSA public key
It seems I have generate the key using RSA type.
Kind regards
Alex
Published by: ao on 12-mar-2012 12:53DSA (Digital Signature Algorithm) keys, by definition, can only be used for the digital signature and not for encryption. As EJP suggested, you must use the RSA key-type and the SHA1withRSA - I would recommend using SHA256withRSA - construct to allow the confidentiality of messages.
Arshad Noor
StrongAuth, Inc.. -
create the example simple encrypt/decrypt string - but without success
Being a newbie crypt I'm trying to build an example of simple string encryption/decryption, but somehow the decrypted result differs too much :-)
Can someone tell me the error in my reasoning? Thank you!
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
Import javax.crypto.BadPaddingException;
Import javax.crypto.Cipher;
Import javax.crypto.IllegalBlockSizeException;
Import javax.crypto.NoSuchPaddingException;
Import javax.crypto.spec.SecretKeySpec;
public class dum_8_decrypt64 {}
Public Shared Sub main (String [] args) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {}
Dim input As String = "Hello, world!";
String key = "nv93h50sk1zh508v";
SecretKeySpec key;
Encryption cipher = null;
Encryption by dcipher = null;
The string result, dresult;
key = SecretKeySpec (passkey.getBytes (new), "AES");
encryption = Cipher.getInstance ("AES/ECB/PKCS5Padding", "Sunjce())");
Cipher.init (Cipher.ENCRYPT_MODE, Key);
result = new String (cipher.doFinal (input.getBytes ()));
System.out.println ("encrypted-> string" + result + "<-");
dcipher = Cipher.getInstance ("AES/ECB/PKCS5Padding", "Sunjce())");
dcipher.init (Cipher.DECRYPT_MODE, Key);
dresult = new String (cipher.doFinal (result.getBytes ()));
System.out.println ("decrypted-> string" dresult + "<-");
}
}
Output:
Encrypted-> string.
p ÿƒG¬µ? (.« <----------
The decrypted-> string Qbkuu $Ñ 5oaw'?) ; Yeutdp3wvk < -.Encrypted data is binary.
String is not a container for binary data.
Maybe you are looking for
-
When writing a new message OR reply to a message, I lost the toolbar that includes the "check spelling" button AND I lost the toolbar which includes 'send '. I can't send messages! Can you help me find these toolbars?
-
Hello! So, I have a HP Pavillion and I use it to play games. I have a problem with moving (key W) and looking around (touchpad). "I talked to a few people who say: ' you must sort PalmCheck ', but my computer isn't that. Help?
-
CD/DVD drive is not recognized after a partially uninstalled program
Original title: I need help. Desperately! I tried to remove some old software using the Control Panel, uninstall. Uninstaller has partially and I got the "Error 1327.Invalid Drive: G:\. "When I reconnected it my drive hard Seagate he came as drive
-
HP P1102 turns off after 4 hours since the last update of firmware - stop it turn off?
I have updated the firmware and my printer drivers for the last realease (17/10/2012) on my P1102 printer. The printer now turns off completely after 4 hours. I changed the setting in the driver to "never turn off" but it makes no difference. It's a
-
How to filter the tables on pages of body only?
I have the following code to manage the tables:for (F_ObjHandleT tableId = F_ApiGetId(FV_SessionId, docId, FP_FirstTblInDoc); tableId; tableId = F_ApiGetId(docId, tableId, FP_NextTblInDoc)) { for (F_ObjHandleT rowId = F_ApiGetId(docId, tableId, FP_