Hi,
  I tried to use setkey and then the cryptoupdate thru rsaprivatekey object.
When I don't return any value(after using setkey) or even if I return a
value, it returns only 6fb8.  This status code specifies that the data is
returned which is of length b8.  When I try to use getResponse, it returns me
6d00.  But I couldn't understand what happens to the data which I return.

Kindly give the suggestion/solution,

I have attached the code too.

Thnx for ur time allocation,

Latha

PN:  Have anybody worked with Cyberflex Access 16K card -
encryption/decryption using asymmetric keys.  If so, can u kindly give a
basic guidance for me?

private void encrypt(APDU apdu)
  {
   buffer = apdu.getBuffer();
   byte numBytes = buffer[ISO.OFFSET_LC];
   byte[] pin = new byte[4];
   pin[0] = 0x00;
   pin[1] = 0x00;
   pin[2] = 0x00;
   pin[3] = 0x00;
   if (ownerpin.check(pin, (byte)0, (byte)4) == false)
    ISOException.throwIt(swVerificationFailed);

   byte tempStore[] = new byte[numBytes];
   byte byteRead = (byte)(apdu.setIncomingAndReceive());
   if ((numBytes != byteRead))
     ISOException.throwIt(ISO.SW_WRONG_LENGTH);

   Util.arrayCopy(buffer, (short) ISO.OFFSET_CDATA, tempStore,
    (short) 0,(short) buffer[ISO.OFFSET_LC]);

      CyberflexFile.selectFile((short)0x3f00);
      byte selfile = CyberflexFile.selectFile((short)1235);
      CyberflexOS os = new CyberflexOS();
   byte readdata = os.readBinaryFile (fileoutbuffer, (short)0, (short)0,
(short) 355);

   rsakey.setKey(fileoutbuffer,(short) 0);
   boolean init = rsakey.isInitialized();
//   rsakey.cryptoUpdate (tempStore, (short) 0, (short) 1, outbuffer, (short)
0);
//   Util.arrayCopy(outbuffer,(short) 0, buffer, (short)0, (short)
(outbuffer.length));

   short le = apdu.setOutgoing();
   apdu.setOutgoingLength((short)1);
   if (init == true)
    buffer[0] =(byte)0;
   else
    buffer[0] =(byte)1;
   apdu.sendBytes((short) 0, (short)1);

  }


Jim Rees wrote:

> You want AsymKey.cryptoUpdate.  This should be described in the Cyberflex
> manual, which you can get from Schlumberger's web site.
> ***************************************************************
> Unix Smart Card Developers - M.U.S.C.L.E.
> (Movement for the Use of Smart Cards in a Linux Environment)
> http://www.linuxnet.com/
> To unsubscribe send an email to [EMAIL PROTECTED] with
> unsubscribe sclinux
> ***************************************************************

***************************************************************
Unix Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/
To unsubscribe send an email to [EMAIL PROTECTED] with
unsubscribe sclinux
***************************************************************

Reply via email to