Home > Default > Problem with cipher.getInstance

Problem with cipher.getInstance

November 30Hits:0
Advertisement
hello,
I am working with JavaCard 2.2.2 on windows with JDK1.5.
I have this fallowing part of code on my card (in fact I use JCWDE):
public void initialisation(){
key = (DESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_DES_TRANSIENT_DESELECT,KeyBuilder.LENGTH_DES, false);
// try{
          ecipher = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD,true);
          dcipher = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD,true);
          ecipher.init(key, Cipher.MODE_ENCRYPT);
          dcipher.init(key, Cipher.MODE_DECRYPT);
//} catch (javacard.security.CryptoException e) {
When I launch it, I have this error:
Java Card 2.2.2 Workstation Development Environment, Version 1.3
Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
jcwde is listening for T=1 Apdu's on TCP/IP port 9 025.
Exception from the invoked install() method:public static void fr.sogeti.Izy.tes.Test.install(byte[],short,byte) throws javacard.framework.ISOException
javacard.framework.ISOException
I dont know why, when i use the debugger mode, this application stop at this line:
ecipher = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD,true);
Could you help me?
Regards
Alexis

Answers

I try but it doesn't work... (same error)
if you want I can put my full code?
my new code:
private byte[] Crypto = {(byte)0xA0, (byte)0x00,
     (byte)0x00, (byte)0x00, (byte)0x62, (byte)0x03, (byte)0x01, (byte)0x0C,
     (byte)0x0f, (byte)0x01, (byte)0x01};
     public void initialisation(){
key = (DESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_DES_TRANSIENT_DESELECT,KeyBuilder.LENGTH_DES, false);
key.setKey(Crypto, (short)0);
// try{
          ecipher = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD,false);
          dcipher = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD,false);
          ecipher.init(key, Cipher.MODE_ENCRYPT);
          dcipher.init(key, Cipher.MODE_DECRYPT);
//} catch (javacard.security.CryptoException e) {
-----

Read other 10 answers

Tags:

Related Articles

  • Problem with cipher.getInstanceNovember 30

    hello, I am working with JavaCard 2.2.2 on windows with JDK1.5. I have this fallowing part of code on my card (in fact I use JCWDE): public void initialisation(){ key = (DESKey)KeyBuilder.buildKey(KeyBuilder.TYPE_DES_TRANSIENT_DESELECT,KeyBuilder.LEN

  • Problem creating Cipher object using getInstanceNovember 30

    Hi all, Can anyone please help me with this? I am using jdk1.4 which has jce. I have put jce.jar jars in classpath. When I create Cipher object like Cipher itsocipher1 = Cipher.getInstance("DES"); it compiles fine but when I exicute it get follo

  • Problem with Cipher.ALG_RSA_PKCS1_OAEP constantNovember 30

    Hi everybody. I've got some data encrypted with RSA public key and padded according to PKCS 1 OAEP. I tried to use this line in the constructor of my applet: private WiMaxApp (byte buffer[], short offset, byte length)           rsa_PrivateCrtKey = (R

  • Cipher.getInstance("DES") gives a Servlet Error!November 30

    Hi - I'm working on Sun ONE Identity Server 6.1 using Sun ONE Web Server 6.1 using J2SDK 1.4.1_05 I've modified one of the files to perform DES Encryption prior to getting some data. The code works fine when compiled separately - even works fine as a

  • Cipher.getInstance closes Applet JAR file.November 30

    I am trying to use a Cipher in a signed Applet in java plugin-1.4 under I.E. Once I execute a Cipher.getInstance the applet jar file is closed and I cannot create any new classes that havent been previously loaded from it. The classloader ends up ret

  • Problem with Cipher.init()October 11

    i am using java 1.4.2 on Windows 2000 Professional I am using "Assembla" as JCE Provider for Microsoft Keystore. But when i call Cipher.init() i am getting the following error MSKeyStoreJNI: Could not acquire context for temporary container used

  • Cipher.getInstance("DES") not working in servlet!November 30

    Hi - I'm working on Sun ONE Identity Server 6.1 using Sun ONE Web Server 6.1 using J2SDK 1.4.1_05 I've modified one of the files to perform DES Encryption prior to getting some data. The code works fine when compiled separately - even works fine as a

  • Running into deadlock when calling to Cipher.getInstanceNovember 30

    HI, I'm running into deadlock when calling to Cipher.getInstance() method on instrumented code, Is this situation familiar to anybody? Is there any solution/workaround. Thanks! "Logger_Init_thread" daemon prio=6 tid=0x0c614bc0 nid=0xebc waiting

  • Cipher.getInstance  ErrorNovember 30

    i got following error when assigning value to Cipher Exception in thread "main" java.lang.UnsatisfiedLinkError: com.sun.javacard.impl.NativeMethods.getCurrentContext()B      at com.sun.javacard.impl.NativeMethods.getCurrentContext(Native Method)

  • Problem using Cipher*Stream and PropertiesNovember 30

    I ran into a tricky problem using CipherInputStream, CipherOutputStream and Properties. I don't seem to find where I'm doing something wrong here. I have something like this: encCipher; // and already initiated ENCRYPTION Cipher FileInputStream fis =

Copyright (C) 2019 wisumpire.com, All Rights Reserved. webmaster#wisumpire.com 15 q. 1.035 s.