JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
RandomData Encryption Using RSA 2048
RandomData Encryption Using RSA 2048
hi
i encrypt randomdata by using cipher ALG_RSA_NOPAD but some times its result is correct or not.
its Exeption throw is 0005.
i am comfeuzed i dont no what shoud i do
asymCipher = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false);
rsaPubKey = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,
KeyBuilder.LENGTH_RSA_2048,false);
random = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
randomData = JCSystem.makeTransientByteArray((short)10,JCSystem.CLEAR_ON_RESET);
byte[] temp = new byte[256];
byte[] outBuff= new byte[256];
random.generateData(randomData, (short)0,(short)randomData.length);
Util.arrayCopy(randomData,(short)0,temp,(short)0,(short)randomData.length);
short bLength = (short)(temp.length - randomData.length);
Util.arrayFillNonAtomic(temp,(short)randomData.length,bLength,(byte)0x00);
asymCipher.init(rsaPubKey, Cipher.MODE_ENCRYPT);
asymCipher.doFinal(temp,(short)0,(short)temp.length, outBuff, (short)0);
i encrypt randomdata by using cipher ALG_RSA_NOPAD but some times its result is correct or not.
its Exeption throw is 0005.
i am comfeuzed i dont no what shoud i do
asymCipher = Cipher.getInstance(Cipher.ALG_RSA_NOPAD, false);
rsaPubKey = (RSAPublicKey) KeyBuilder.buildKey(KeyBuilder.TYPE_RSA_PUBLIC,
KeyBuilder.LENGTH_RSA_2048,false);
random = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
randomData = JCSystem.makeTransientByteArray((short)10,JCSystem.CLEAR_ON_RESET);
byte[] temp = new byte[256];
byte[] outBuff= new byte[256];
random.generateData(randomData, (short)0,(short)randomData.length);
Util.arrayCopy(randomData,(short)0,temp,(short)0,(short)randomData.length);
short bLength = (short)(temp.length - randomData.length);
Util.arrayFillNonAtomic(temp,(short)randomData.length,bLength,(byte)0x00);
asymCipher.init(rsaPubKey, Cipher.MODE_ENCRYPT);
asymCipher.doFinal(temp,(short)0,(short)temp.length, outBuff, (short)0);
Re: RandomData Encryption Using RSA 2048
Pls show us public key and the temp data when you caught exception.
Could you also tell us whether the following code will be executed everytime you run your code?
Could you also tell us whether the following code will be executed everytime you run your code?
Code: Select all
randomData = JCSystem.makeTransientByteArray((short)10,JCSystem.CLEAR_ON_RESET);
byte[] temp = new byte[256];
byte[] outBuff= new byte[256];
Re: RandomData Encryption Using RSA 2048
randomData = JCSystem.makeTransientByteArray((short)10,JCSystem.CLEAR_ON_RESET);
byte[] temp = new byte[256];
byte[] outBuff= new byte[256];
they are in to constractor class.
the result of random data encryption some time is correct and its sw is 9000 and some time it is throw cipherexception 0005
byte[] temp = new byte[256];
byte[] outBuff= new byte[256];
they are in to constractor class.
the result of random data encryption some time is correct and its sw is 9000 and some time it is throw cipherexception 0005
Re: RandomData Encryption Using RSA 2048
Could you tell me the card type you are using?
Re: RandomData Encryption Using RSA 2048
I dont know what is type of my card. How can i underestand?
Who is online
Users browsing this forum: No registered users and 52 guests