Java Cryptographic Extension
Hi Forum,
Just commenced an academic project on Cryptography in Uni today and started studying some materials. I have tried to import SunJCE into my java class by specifying the statement "import com.sun.crypto.provider.SunJCE" in an enclipse work space and I have this error "Access restriction: The type SunJCE is not accessible due to a restriction on required library C:\Program Files\Java\jre6\lib\ext\sunjce-provider.java".
What exactly does this error entail and how can I go about surmounting it?
Cheers!
Why do you think you need that import? If you are using a Sun JDK then the SunJCE provider is normally the default provider. If you are using an IBM JDK then the IBM provider is normally the default. You only need to create an instance of a Provider if you need it to handle either a cryptographic algorithm that is not available in the default provider or if you are dealing with a Provider for an HSM (or other hardware based encryption). In these cases you will install the provider provided by the hardware or library you are trying to access.
P.S. Have you installed the 'unlimited strength' jars?
Similar Messages
-
Does anyone know of any Sun Classes for Java Cryptographic Extension -JCE ?
Hello - anyone know of any Sun Classes for Java Cryptographic Extension? If so do you have the Sun class code/s?
Edited by: Mister_Schoenfelder on Apr 17, 2009 11:31 AMMaybe this can be helpful?
com.someone.DESEncrypter
======================
package com.someone;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.KeySpec;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
public class DESEncrypter {
Cipher ecipher;
Cipher dcipher;
// 8-byte Salt
byte[] salt = {
(byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
(byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03
// Iteration count
int iterationCount = 19;
public DESEncrypter(String passPhrase) {
try {
// Create the key
KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray(), salt, iterationCount);
SecretKey key = SecretKeyFactory.getInstance(
"PBEWithMD5AndDES").generateSecret(keySpec);
ecipher = Cipher.getInstance(key.getAlgorithm());
dcipher = Cipher.getInstance(key.getAlgorithm());
// Prepare the parameter to the ciphers
AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount);
// Create the ciphers
ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
} catch (java.security.InvalidAlgorithmParameterException e) {
e.printStackTrace();
} catch (java.security.spec.InvalidKeySpecException e) {
e.printStackTrace();
} catch (javax.crypto.NoSuchPaddingException e) {
e.printStackTrace();
} catch (java.security.NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (java.security.InvalidKeyException e) {
e.printStackTrace();
public DESEncrypter(SecretKey key) {
try {
ecipher = Cipher.getInstance("DES");
dcipher = Cipher.getInstance("DES");
ecipher.init(Cipher.ENCRYPT_MODE, key);
dcipher.init(Cipher.DECRYPT_MODE, key);
} catch (javax.crypto.NoSuchPaddingException e) {
e.printStackTrace();
} catch (java.security.NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (java.security.InvalidKeyException e) {
e.printStackTrace();
public String encrypt(byte[] data) {
return encrypt(new sun.misc.BASE64Encoder().encode(data), false);
public byte[] decryptData(String s) throws IOException {
String str = decrypt(s, false);
return new sun.misc.BASE64Decoder().decodeBuffer(str);
public String encrypt(String str, boolean useUTF8) {
try {
// Encode the string into bytes using utf-8
byte[] utf8 = useUTF8 ? str.getBytes("UTF8") : str.getBytes();
// Encrypt
byte[] enc = ecipher.doFinal(utf8);
// Encode bytes to base64 to get a string
return new sun.misc.BASE64Encoder().encode(enc);
} catch (javax.crypto.BadPaddingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (java.io.IOException e) {
e.printStackTrace();
return null;
public String decrypt(String str, boolean useUTF8) {
try {
// Decode base64 to get bytes
byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str);
// Decrypt
byte[] utf8 = dcipher.doFinal(dec);
// Decode using utf-8
return useUTF8 ? new String(utf8, "UTF8") : new String(utf8);
} catch (javax.crypto.BadPaddingException e) {
e.printStackTrace();
} catch (IllegalBlockSizeException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (java.io.IOException e) {
e.printStackTrace();
return null;
// Here is an example that uses the class
public static void main(String[] args) {
try {
// Generate a temporary key. In practice, you would save this key.
// See also e464 Encrypting with DES Using a Pass Phrase.
SecretKey key = KeyGenerator.getInstance("DES").generateKey();
// Create encrypter/decrypter class
DESEncrypter encrypter = new DESEncrypter(key);
// Encrypt
String encrypted = encrypter.encrypt("Don't tell anybody!", true);
// Decrypt
String decrypted = encrypter.decrypt(encrypted, true);
} catch (Exception e) {
e.printStackTrace();
try {
// Create encrypter/decrypter class
DESEncrypter encrypter = new DESEncrypter("My Pass Phrase!");
// Encrypt
String encrypted = encrypter.encrypt("Don't tell anybody!", true);
// Decrypt
String decrypted = encrypter.decrypt(encrypted, true);
} catch (Exception e) {
e.printStackTrace();
} -
Error : JAVA Cryptographic Toolkit sap java library archive
Hi Experts
I am trying to install SAP Net Weaver 04 support release 1 > oracle JAVA System. I am performing installation on Windows 2003 server.
While installing the JAVA Cryptographic Toolkit > sap java library archive I have getting problem please give any idea about this.
Where I get this path how to download the SAP JAVA library archive file.
Error finds out shown bellow
Regards,
Rahulhi Rahul
You'll find the file on the following link:
Web page: http://java.sun.com/javase/downloads/index.jsp
(see section "Other downloads", "Java Cryptography Extension (JCE)
Unlimited Strength Jurisdiction Policy Files 5.0").
Regards
Ariyanto
(hi moderator, sorry for double posting, just notice that i have 2 IDs)
Edited by: Ariyanto Hong on Apr 2, 2008 3:23 PM -
JCDK with cryptographic extension
Is there anyone that can me where to download the binary version for Java Card Development Kit 2.2 with cryptographic extension? It is mentioned in the release notes from Java Card Development Kit 2.2. Many thanks.
you will need to license it from $un.
-
For a long time, each time Firefox updates, it invites me to install theJava Console Update. then I get a message that Java Console not supported.
You can uninstall (remove) the Java Console extensions and disable the Java Quick Starter extension, you do not need them to run Java applets.
See http://kb.mozillazine.org/Java#Multiple_Java_Console_extensions
Disable the Java Quick Starter extension (if you have it): Tools -> Add-ons -> Extensions<br />
Control Panel -> Java -> Advanced tab -> Miscellaneous -> Java Quick Starter (disable)
See http://www.java.com/en/download/help/quickstarter.xml - What is Java Quick Starter (JQS)? What is the benefit of running JQS? - 6.0 -
Yesterday the following message appeared in my browser (Firefox 3.6.13):
"The Java Console extension is no longer supported and will be automatically removed the next time you restart Firefox. This will not affect any Java applications or websites in any way."
After receiving this message, the formatting buttons in the reply boxes of this SMF forum would not display.
http://www.thechristianidentityforum.net/smf/
And when I clicked on the "Listen Live" link at the site below, I got a "Cannot create DirectShow player" error message.
http://www.3aw.com.au/
How do I fix this?
Many thanks in advance for your help.Clear the cache and the cookies from sites that cause problems.
* "Clear the Cache": Tools > Options > Advanced > Network > Offline Storage (Cache): "Clear Now"
* "Remove the Cookies" from sites causing problems: Tools > Options > Privacy > Cookies: "Show Cookies"
Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
* Don't make any changes on the Safe mode start window.
See:
* [[Troubleshooting extensions and themes]] -
hi..
i want access android resource..
for example, res/menu/menu.xml, res/values/strings.xml ... etc...
- R.java -
/* AUTO-GENERATED FILE. DO NOT MODIFY.
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
package com.flash.extension.nativelib;
public final class R {
public static final class attr {
public static final class drawable {
public static final int icon=0x7f020000;
public static final int notification_icon=0x7f020001;
public static final class layout {
public static final int main=0x7f030000;
public static final class string {
public static final int extension_app_name=0x7f040001; -> "hi extension"
public static final int extension_hello=0x7f040000;
so i used getResourceId("string.extension_app_name");
but it's not work.. throw NotFoundException error..
so i used context.getString(R.string.extension_app_name);
it's work, but return incorrect value.. -> return value is "0.0.0".. it's versionName in actionScript Client Project..
why can't access android resource in native extension?
how to get android resource in java natvie extension..??
Is there anyone who has a sample source??
help.. me.. please..Hello,
I am facing the same issue with the native extension i am using follwing code to get the resource id
Intent inte = new Intent(context.getActivity().getApplicationContext(),SecondActivity.class);
inte.putExtra("layout",context.getResourceId("layout.secondactivity"));
context.getActivity().startActivity(inte);
i am getting this exception "android.content.res.Resources$NotFoundException:layout.secondactivity"
I have included activity in the native manifest file as well as flex's manifest file for android.
please help me with this or an example will be great thanks. -
Hi ,
i m unable to run a java3d application .its giving err as "java 3d extensions not installed"
plz help me solving it
tnx1. What platform are we talking about?
2. Did you install the 3d extensions?
3. What sample application are you trying to see if it works? -
JAVA Cryptographic Toolkit sap java library archive
Hi Experts
I am trying to install SAP Net Weaver 04 support release 1 > oracle JAVA System. I am performing installation on Windows 2003 server.
While installing the JAVA Cryptographic Toolkit > sap java library archive I have getting problem please give any idea about this.
Where I get this path how to download the SAP JAVA library archive file.
Error finds out shown bellow
Regards,
RahulRahul wrote:>
> Hi Experts
>
> I am trying to install SAP Net Weaver 04 support release 1 > oracle JAVA System. I am performing installation on Windows 2003 server.
> While installing the JAVA Cryptographic Toolkit > sap java library archive I have getting problem please give any idea about this.
if you would give us the error message we could give you an advise.
> Where I get this path how to download the SAP JAVA library archive file.
on the screen where you need to enter the path to the JCT, the links are given on where to download those libararies.
Markus -
SPS 18 Installation fails while asking for Java Crypthography Extension
Hi @ all,
some weeks ago we deployed the file "tc_sec_java_crypto_signed_fs_lib.sda by the SDM. But we didn´t enabled strong encryption in the portal.
Now, i want to update my portalstack from SPS 14 to SPS 18 and while i update J2EE Sapinstaller asks for Java Crypthography Extension-Source-Code. But i don´t want to install it, because automatically the database is set to strong encryption and i can´t use / administrate in anymore.
I still undeployed the IAEK-FS-File but the problem persists.
I´m very pleasent for every answer.
Best Regards
LarsHey,
that´s fine Sascha.
It works greatly. SPS 18 not asking für JCE anymore.
The Installation is now running.
Thx a lot!
Greetingz
Lars -
Need to install Java Cryptographic Toolkit
I need to install the Java Cryptographic toolkit. In order to do that, I need to have J2SE. How can I tell if J2SE is installed? and if it is installed what version is it?
I have checked http://server:port and then system information. I don't see J2SE there. Under components, I have SAP-JEE and SAP-JEECOR.Hi
SAP Java Cryptographic
You can get it from the SAP Service Marketplace at service.sap.com/download under Download -> SAP Cryptographic Software.
also There is a guide out there on SDN. Enabling SSL for the SAPJ2EE Engine
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/ghi/installation%20guide%20-%20enabling%20ssl%20for%20the%20sap%20j2ee%20engine
http://help.sap.com/saphelp_nw04/helpdata/en/55/79cf4f7692064d969527a90e8e86c5/frameset.htm
Thanks -
SAP Java Cryptographic Toolkit
Hi All,
I am useing EP 6.0, SP11. Could anyone please explain me how to determine if the SAP Java Cryptographic Toolkit is on the SAP J2EE engine. Is there anyway to find from the Portal?
Thnks for you help
Regards
HenryHi Henry,
You can find out that easily by logging into Visual Admin.
Navigate to this and you can find:
Goto Dispatachexx>Libraries>tc/sec/ssl
and also
Goto Dispatachexx>Libraries>IAIKSecurity
You can see entries here.
Regards,
Piyush
ps: please mark for all useful answers. -
No sdas for Java Cryptographic Toolkit
Hello all,
I want to install Java Cryptographic Toolkit on my WAS 6.40. I see the related doc
http://help.sap.com/saphelp_nw04/helpdata/en/f1/2de3be0382df45a398d3f9fb86a36a/frameset.htm
Unfortunately, it is said:
"Using the SDM Remote GUI, connect to the SAP J2EE Engine and deploy the SAP Java Cryptographic Toolkit SDA that applies to your J2SE version (1.3.x or 1.4.x). "
But I do not have sda for the Toolkit.
What I have is 3 jar files (iaik_jsse.jar, iaik_jce.jar and iaik_ssl.jar), and some txt file.
I've allready installed the crypto lib (sapcrypto.dll).
Can anyone tell me where to find the sda or how to install crytpo toolkit without it ?
Thanks
SylvainHi Sylvain,
you can download the SDA file for cryptographic toolkit from the service.sap.com
Here, goto the Downloads option. There you can find SAP Cryptographic Software link. Here download <i>"SAP JAVA CryptoToolkit (J2EE Engine as of Release 6.30)"</i>.
Regards,
Bhavik -
SAP Cryptographic Library Vs JAVA Cryptographic Library
Hello All,
Whats the functional difference between SAP Cryptographic Library and JAVA Cryptographic Library. How they differ in fuctionality and When do we use one over the other. Naming convention says both are different but I am not sure of the functional difference. Any help in making me understand this is appriciable.
Thanks in advance.
Farooq.Well, it's pretty easy:
"SAP Cryptographic Library" (aka "SAPcryptolib") is a native library (DLL) - and therefore platform-specific. It's typically used with components such as WebAS ABAP, JCO, WebDispatcher, etc.
"Java Cryptographic Library" (aka "IAIK Toolkit") is implemented in Java. It's typically used for the WebAS Java. -
Algorithms for Signing & Encryption for SAP Java cryptographic Tool kit
Hi,
We want to use SAP Java Cryptographic Toolkit for S/MIME for signing & encryption. Kindly let me know what are all the algorithms it supports for Signing & algorithms it supports for Encryption
With Regards
K.VaradharajanDES (Data Encryption Standard) algorithm is used to perform the encryption
Policy jurisdiction files regulate which algorithms are available. These jurisdiction files are provided by the same vendor as for your J2SE package.
Regards,
Prateek
Maybe you are looking for
-
Fields missing in Characteristic Relationship
Hi Experts, I want to derive Currency Key from Company code using Characteristic Relationship. I am using 'With Derivation' and master data attributes. But in the source fields I see only two fields Cost Center and Controlling Area. Not sure why I am
-
Access violation at address 6761D581 in module 'ORA805.dll'.
hi Gurus, When ever I try to connect the database through toad , I got this error 'Access violation at address 6761D581 in module 'ORA805.dll'. Read of address 00000010'. Please help me to resolve this issue. Oracle database: 10.2.0.1.0 Oracle client
-
Passing parameter to CFC while using CFGRID bind
I am attempting to use CFGRID to display some data. I have a CFGRID set up using a bind to a CFC which is fine for a hard coded SQL but I want to pass a parameter. I started with the example at http://www.garyrgilbert.com/blog/ind...sion-8s-CFGRID I'
-
Chatting with .mac accounts
hello; i have used iChat to talk with aim and aol users, but i just had a friend who joined .mac and when i added her to the buddy list i chose .mac account type (not aim etc...) but it won't let me see her or contact her. she can see me, so it's pos
-
Can you boot up using time machine
can you boot up using time machine? have continuous grey screen at startup.