I had the same problem, which is inherent to Javacard, not just due to the use
of gemplus' Gx211.
Only "global arrays" can be shared. So, if you declare a byte[] in one applet
and try to give its reference to another (even if the first implements a
shareable interface) it doesn't work.
The javacards i know do not provide way to declare "global arrays". That is the
reason why sun's javacard kit
examples use the apdu buffer : it is the only known global array. You do not
have to send data, you just use the apdu buffer (which is a byte[]) as a simple
buffer

imagine your first applet with a method :

public byte[] m()
{
byte[] apdubuff = [a reference to the apdu buffer coming from outer space]
...

apdubuff[5]  = ... // it is safer not to explode the first 5 bytes

return apdubuff;
}

and then, the applet receiving the byte[] can read/write it, but do not forget
that this byte[] is the apdu buffer.
All you have to do is to set coventions for the offset of intersting bytes, and
so on.

cheers,
Sebastien.




Norbert Diernhofer a �crit :

> I'm writing an application which is accessing another applet within a
> Javacard in another context. When I return just a byte, then everything is
> ok. But returning a byte[] doesn't work. In the book of Zhiqun Chen on smart
> cards this problem is discussed and the solution for this problem is to use
> the ADPU Buffer, but how do I write to the buffer without sending data?
> Is there another, more convenient solution?
>
> My idea as follows :
>
> 1. Applet 1 calls Applet 2 - working
> 2. Applet 2 does some processing, tries to return an answer to Applet 1 -
> doesn't work when sending more than a primitive
> 3. Applet 1 sends the answer to the CAD - working
>
> What ca I do to make this work?
>
> Sincerely
> Norbert Diernhofer
>
> ---
> > Visit the OpenCard web site at http://www.opencard.org/ for more
> > information on OpenCard---binaries, source code, documents.
> > This list is being archived at http://www.opencard.org/archive/opencard/
>
> ! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
> ! to
> !                           [EMAIL PROTECTED]
> ! containing the word
> !                           unsubscribe
> ! in the body.



---
> Visit the OpenCard web site at http://www.opencard.org/ for more
> information on OpenCard---binaries, source code, documents.
> This list is being archived at http://www.opencard.org/archive/opencard/

! To unsubscribe from the [EMAIL PROTECTED] mailing list send an email
! to
!                           [EMAIL PROTECTED]
! containing the word
!                           unsubscribe 
! in the body.

Reply via email to