JCard 프로그래밍 초보자입니다. (2 일 경험 ...) RSA KeyPair를 생성하고 일반인에게 보내는 CREF 에뮬레이트 된 카드에 앱을 배포하려고합니다. 나는 클라이언트 응용 프로그램에서 init 메소드를 실행하면 호스트 RMI 클라이언트 응용 프로그램을 통해 키, 어떻게 든이 예외가 얻을 :RSA 키 생성이 JCARD 2.2.2에서 실패합니다.
package sid2;
import java.rmi.RemoteException;
import javacard.framework.UserException;
import javacard.framework.service.CardRemoteObject;
import javacard.security.*;
import javacardx.crypto.Cipher;
public class CompteurImpl extends CardRemoteObject implements ICompteur {
private byte compteur = 120;
RSAPrivateKey rsa_PrivateKey;
RSAPublicKey rsa_PublicKey;
KeyPair rsa_KeyPair;
Cipher cipherRSA;
public void setPub(byte[] expo, byte[] mod) {
rsa_PublicKey.setExponent(expo, (short) 0, (short) expo.length);
rsa_PublicKey.setModulus(mod, (short) 0, (short) mod.length);
}
public byte[] getPub() {
byte[] ret = null;
rsa_PublicKey.getModulus(ret, (short) 0);
rsa_PublicKey.getExponent(ret, (short) (ret.length + 1));
return ret;
}
public void initialiser(byte v) throws RemoteException, UserException {
rsa_KeyPair = new KeyPair(KeyPair.ALG_RSA, KeyBuilder.LENGTH_RSA_2048);
rsa_KeyPair.genKeyPair();
rsa_PublicKey = (RSAPublicKey) rsa_KeyPair.getPublic();
rsa_PrivateKey = (RSAPrivateKey) rsa_KeyPair.getPrivate();
compteur = v;
}
}
: 여기
Exception in thread "main" java.lang.UnsatisfiedLinkError:
com.sun.javacard.impl.NativeMethods.getCurrentContext()B
at com.sun.javacard.impl.NativeMethods.getCurrentContext(Native Method)
at com.sun.javacard.impl.PrivAccess.getCurrentAppID(PrivAccess.java:454)
at javacard.framework.CardRuntimeException.<init>(CardRuntimeException.java:46)
at javacard.security.CryptoException.<init>(DashoA10*..:25)
at com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory.throwIt(Unknown Source)
at com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory.throwException(Unknown Source)
at com.sun.javacard.javax.smartcard.rmiclient.CardObjectFactory.getObject(Unknown Source)
at com.sun.javacard.rmiclientlib.JCRemoteRefImpl.parseAPDU(Unknown Source)
at com.sun.javacard.rmiclientlib.JCRemoteRefImpl.invoke(Unknown Source)
at sid2.CompteurImpl_Stub.initialiser(Unknown Source)
at sid2.ClientRmi.main(ClientRmi.java:36)
및 호출되는 내 JCard 애플릿의 코드입니다
아무도 내가 여기서 잘못하고있는 것을 지적 할 수 있습니까?
추신 : 저는 기본적인 것들을 이미 시도해 보았습니다. Jcard에 변수가 있고 그것을 증가시키고 설정하고 설정하는 것처럼 잘 작동했습니다.
감사합니다! 너는 생명의 은인이야. –