How can I share Pin variable between two packages?

Hi every one,
Is there any one who knows how can I share Pin variable that it is defined with OwnerPin between two packages in java card( with eclipse 3.1),I studied Sharing Interface subject and I knows it teorical but I can not do it practical .
I can share primitive data type but I can not share Ownerpin.
If anybody has some sample codes or knows any link ,please inform me.
My code is same as below:
//In Server Side
package ginaPack;
import javacard.framework.*;
public class GinaApplet extends Applet implements GinaInterface{
OwnerPIN pin;
private GinaApplet (byte[] bArray,short bOffset,byte bLength) {
    pin =new OwnerPIN(PIN_TRY_LIMIT,MAX_PIN_SIZE);
          byte PinTemp[] = new byte[4];
          PinTemp[0] = (byte) 0x31;
          PinTemp[1] = (byte) 0x31;
          PinTemp[2] = (byte) 0x31;
          PinTemp[3] = (byte) 0x31;
          pin.update(PinTemp, (short) (0), (byte) PinTemp.length);       
    public Shareable getShareableInterfaceObject(AID clientAID,byte parameter)
          return  this;
    public OwnerPIN getPinShareable()
         return pin;         
     public void process(APDU apdu)
                  //there are some codes in this here
}//Interface in Server side
public interface GinaInterface extends Shareable
      public OwnerPIN getPinShareable();
}//In Client side
import ginaPack.*;
public class UserCardApplet extends Applet {
private UserCardApplet(byte[] bArray, short bOffset, byte bLength) {
     //there are some codes in this here
public boolean select() {
          final byte[] Gina_AID={(byte)0x47,(byte)0x69,(byte)0x6e,(byte)0x61,(byte)0x41,(byte)0x70,(byte)0x70,(byte)0x6c,(byte)0x65,(byte)0x74};
          AID GinaAID = JCSystem.lookupAID( Gina_AID, ( short )0,( byte )Gina_AID.length );
          if ( GinaAID == null ) // probably not loaded on card
                    ISOException.throwIt( ISO7816.SW_FUNC_NOT_SUPPORTED );//6a 80
          GinaInterface ff = (GinaInterface) JCSystem.getAppletShareableInterfaceObject(GinaAID,(byte)0);
          if( ff == null )
               ISOException.throwIt((short)0x0903);
if ( ff.getPinShareable().getTriesRemaining()== 0 ) return false;
}My problem is in this line :
"if ( ff.getPinShareable().getTriesRemaining()== 0 ) return false; "when I select my applet this line throw an exception, ff.getPinshareable includes all of OwnerPin methods(such as getTriesRemaining ,check ,reset, update ,...)but all of them throw exception .
I think firewal does not allow other packages uses this methods .If my guess is right then what should I do for sharing the variables that they are defined with non primitive data type such as (OwnerPin,Signature,...)
I'd appriciated for any help.
yours sincerely,
Orchid.
Message was edited by:
NewOrchid

Applet 1:
package com.package1;
import javacard.framework.*;
public class Applet1 extends Applet {
    private static final byte tryLimit  = (byte)3;
    private static byte[] pinBytes = {(byte)1, (byte)7, (byte)4, (byte)5, (byte)2};
    private Library1 lib;
    protected Applet1(byte bArray[], short bOffset, byte bLength) throws PINException {
        lib= new Library1(tryLimit, (byte)pinBytes.length);
        lib.update(pinBytes, (short)0, (byte)pinBytes.length);
        register();
    public static void install(byte[] bArray, short bOffset, byte bLength) {
        new Applet1(bArray, bOffset, bLength);
    public void process(APDU apdu) {
        byte status=(byte)0;
        lib.resetAndUnblock();
        if (!(lib instanceof Shareable)) status += (byte)2;
        if (!(lib instanceof MyPIN)) status += (byte)4;
        ISOException.throwIt(Util.makeShort((byte)0x90, status)); // sw indicates tries remaining
    public Shareable getShareableInterfaceObject(AID cltAID, byte parm) {
        return lib;
}Library1:
package com.package1;
import javacard.framework.OwnerPIN;
import javacard.framework.PINException;
public class Library1 extends OwnerPIN implements Interface1{
    public Library1(byte tryLimit, byte maxPINSize) throws PINException {
        super(tryLimit, maxPINSize);
}Interface1:
package com.package1;
import javacard.framework.PIN;
import javacard.framework.Shareable;
public interface Interface1 extends Shareable {
    boolean check(byte[] pin, short offset, byte length);
    byte getTriesRemaining();
    boolean isValidated();
    void reset();
}Applet2:
package com.package2;
import javacard.framework.*;
import com.package1;
public class Applet2 extends Applet {
    private final static byte CLA_TEST = (byte)0x80;  
    private final static byte INS_TEST = (byte)0x20;
    private final static byte P1_AUTHORIZE = (byte)0x00;
    private final static byte P1_DOIT = (byte)0x01;
    private final static byte P1_CHECK_SIO = (byte)0x0a;
    private Interface1 sio;
    protected Applet2(byte bArray[], short bOffset, byte bLength) {
        register();
    public static void install(byte[] bArray, short bOffset, byte bLength) {
        new Applet2(bArray, bOffset, bLength);
    public void process(APDU apdu) {
     byte[] buffer = apdu.getBuffer();
        if ((buffer[ISO7816.OFFSET_CLA] == CLA_TEST) ||
            (buffer[ISO7816.OFFSET_CLA] == ISO7816.CLA_ISO7816)) {
            short bytesReceived = apdu.setIncomingAndReceive();
            switch (buffer[ISO7816.OFFSET_INS]) {
            case ISO7816.INS_SELECT:
                if (!JCSystem.getAID().equals(buffer, ISO7816.OFFSET_CDATA, buffer[ISO7816.OFFSET_LC]))
                    ISOException.throwIt(ISO7816.SW_APPLET_SELECT_FAILED);
                sio = (Library1)JCSystem.getAppletShareableInterfaceObject(JCSystem.lookupAID(<fill in parameters>);
                if (sio == null)
                    ISOException.throwIt(ISO7816.SW_CONDITIONS_NOT_SATISFIED);            
                break;
            case INS_TEST:
                switch (buffer[ISO7816.OFFSET_P1]) {
                case P1_AUTHORIZE:
                    if (!sio.isValidated()) {
                        if(!sio.check(buffer, ISO7816.OFFSET_CDATA, buffer[ISO7816.OFFSET_LC]))
                            ISOException.throwIt(Util.makeShort((byte)0x9A, sio.getTriesRemaining()));
                    break;
                case P1_DOIT:
                    if (!sio.isValidated())
                        ISOException.throwIt(ISO7816.SW_SECURITY_STATUS_NOT_SATISFIED);
                    sio.reset();
                    ISOException.throwIt(Util.makeShort((byte)0x9A, sio.getTriesRemaining()));                
                    break;
                default:
                    ISOException.throwIt(ISO7816.SW_INCORRECT_P1P2);                   
                break;
            default:
                ISOException.throwIt(ISO7816.SW_INS_NOT_SUPPORTED);
        else {
            ISOException.throwIt(ISO7816.SW_CLA_NOT_SUPPORTED);
}1. Upload package1
2. Install Applet1
3. Select Applet1
4. Upload package2
5. Install Applet2
6. Select Applet2

Similar Messages

  • TS4001 How can I share Safari bookmarks between two iCloud accounts using IOS 7 and Mavericks?

    Before iOS 7 and Mavericks, we were able to share Safari bookmarks between all of our devices.  My wife had the primary iCloud account which was setup to share bookmarks, contacts, calendars and reminders.  A secondary iCloud account was setup on my phone for only my email.  Each phone had our private email accounts segregated and we shared all the bookmarks, contacts, calendars and reminders.  When I saved a bookmark on my phone, I could see it later on our iMac or iPad.  Now only my wife can sync bookmarks between her phone and the iMac or iPad.  This *****!!  This worked beautifully before we upgraded to the latest versions of OS & iOS.  Is there a work around or a new way to set things up?  I don't want to be stuck reading Safari on my phone when I have a 24" iMac sitting in the living room.  I don't want to see all of my wife's email on my phone either.  Do we need three iCloud accounts now?  One main for sharing and two separate accounts for only email?  Need help!  Any suggestions would be appreciated, thanks.

    David,
    Thanks for the reply.  That's how I set it up originally.  Although the new iOS 7 update lost some functionality.  I found the following on the TUAW website.  The Safari Bookmarks and Find My Phone options have been removed from the secondary iCloud accounts options.  This is the problem.  Everything worked great before we updated.  I guess "new way" consolidates the iCloud accounts better with Maverick?  Now I will have extra documents on my phone that I don't need.  We will both have to share the same iCloud storage and backup space too.  Have to try it out and see how it works. Thanks.
    http://www.tuaw.com/2013/09/19/how-to-use-multiple-apple-ids-in-ios-7/

  • How can I share a folder between two users on the same mac?

    Hi all,
    I would like to share a folder between multiple users on the same macbook without having to transfer the folder to the Public/Shared folder.
    Is there not a way, using the the folders shared permissions, to allow shared folders from one user to be visible and usable by another user on the same mac without having to move the folder to a designated shared location?
    Regards,
    Caleb

    jrwood116 wrote:
    Thanks, but do you have to do that every time you share a folder?
    No, you just need to do it once and that's it. Anything that is in the Shared folder is accessible by all user accounts within the same Mac.
    jrwood116 wrote:
    I've read numerous 'how to share a folder' blogs and they just say it's as simple as clicking 'share' and allowing specific users to access it...none have mentioned this (not saying your advice is wrong at all, just don't get why no-one else has mentioned what appears to be a key step!)
    Can you give me an example of such a blog. I suspect you may have mis-understood what they were saying but if you can provide a link, I'll look at it.

  • How can I share a folder between two users on the same iMac?

    I have an iMac with 2 user accounts and I want to share a folder between them. I have gone on to system preferences>sharing and turned on file sharing. I have also got the 'Get Info' thing up, selected 'Shared Folder' and added the other user to the read and write permissions...it just doesn't show up on the other desktop (the folder is on my desktop, I would have expected to see it on the other desktop...?)
    Any ideas?

    jrwood116 wrote:
    Thanks, but do you have to do that every time you share a folder?
    No, you just need to do it once and that's it. Anything that is in the Shared folder is accessible by all user accounts within the same Mac.
    jrwood116 wrote:
    I've read numerous 'how to share a folder' blogs and they just say it's as simple as clicking 'share' and allowing specific users to access it...none have mentioned this (not saying your advice is wrong at all, just don't get why no-one else has mentioned what appears to be a key step!)
    Can you give me an example of such a blog. I suspect you may have mis-understood what they were saying but if you can provide a link, I'll look at it.

  • How can we share  setting Header between two servlets-Urgent

    Hi ,
    I have setting one Header on my 1st servlet and but I need to access same header on my 2nd servlet. Please tell me how can I solve this issues?
    Regards,
    Pattanaik

    Sorry, misread the first time.
    As long as you don't write to the body of the response in the first servlet, you should be able to write to the header in the second. So is your problem that both servlets try to write to the body of the response?
    Edited by: paulcw on Nov 12, 2007 9:07 PM

  • How can I share address lists between two iCloud users

    My daughter and I have two different icloud accounts.  We are able to share certain calendars, but I would like also to share address lists/groups.  Is there a way to do this?  I think you could "subscribe" to another Mobile Me user, but how is this done in ICloud?

    I do understand that if we have the same Icloud account and Apple ID then they will sync automatically.  We don't.  I have just separated our accounts (on purpose).  Via icloud we can share calendars, but I want to share address lists too.  Can address lists be shared (or subscribed to) by two different icloud users with two different Apple IDs? 
    Anybody know?

  • How can i share purchased apps between 2 diff users on the same mac?

    How can I share purchased apps between 2 diff users on the same mac?

    A purchased app is associated with an Apple ID. A user with a different Apple ID cannot use the app unless they also use the same Apple ID.
    I cannot use my wife's apps nor she mine because each were purchased with different Apple IDs.

  • HT4539 How can I share my downloads between my two computers

    How can I share my I tune down loads between my two I pads?

    iTunes content can only be shared to an iPad or iPhone. (iOS based devices only).

  • How can i set the space between two button?

    Hello,
    I have
    <mx:HBox>
    <mx:Button label="one" />
    <mx:Button label="two" />
    </mx:HBox>
    how can i set the distance between this two compotents?
    Thanks

    quote:
    Originally posted by:
    robinbouc77
    Hi,
    you can use horizontalGap property on HBox to change the
    space between your buttons. I think the default value is 6. You can
    also use <mx:Spacer/>, but changing the gap on HBox is
    probably the cleanest way ;)
    C U
    perfect!!! works fine

  • Can I share an Ipod between two User accounts

    Trying to share one Ipod between two accounts ! but dont seem to be able to download from different accounts onto Ipod, outside of Ipod original account !!

    Other users on the machine should already be able to see the apps assuming they're not installed in a specific users ~/applications folder.
    Are they not visible?
    If the app is in the ~/applications folder you might want to try moving it to the /applications folder.

  • How can we share e-books between 2 accounts?

    My husband and I both have Kobo accounts, Adobe DE accounts and 2 separate e-book readers (both Aluretek Libre's).
    How can we share books?
    cm

    One of you will have to buy the book first (and put on reader, I assume).  According to what Kobo Customer Care told me, with Adobe Digital Editions open that person then goes on the site the book was bought from, signs in, goes on purchase history and clicks on the book.  Hit Download epub or pdf, choose Open for Windows or Save for Mac, Adobe will show the book.  make sure you are in library view, plug the reader in and authorize the device.  Drag and drop the book into the reader icon that shows up under the Bookshelf items.  It should copy the file.  When done, eject using the safely remove mass storage device option.  After unplugging, it will process the new content.  I haven't done it yet, I just received the instructions.

  • How do I share iTunes music between two user accounts?

    We have two (admin) user accounts on our iMac. My husband has downloaded tons of music from CDs to his iTunes library. How can I get some of his music to my iTunes library without having to re-download from CDs? If anyone can give me simple instructions it would be appreciated.
    Thanks Jeanette.

    Look at this article: iTunes: How to share music between different accounts on a single computer, http://support.apple.com/kb/HT1203

  • How can I share files/libraries between users?

    I have tried to enable file sharing between me and my hubby. I would like to share iTunes and iPhoto libraries but cannot. I don't want to have the same photos & CDs replicated just so we can have two different logins.
    How can I do this?

    Hi, Loker. Welcome to the Discussions.
    Mac OS X and other UNIX®-based systems, in general, are not set up to easily share data between users. A fundamental idea behind UNIX security is each user's data is theirs and theirs alone, and a user must take steps to share data on their accounts with other users, either on that computer or over a network. This is why, in Mac OS X, the Users > Shared folder exists: all users have Read & Write access to such, providing a "commons" for easily sharing documents between users on the same Mac. The Public folders in each account are extant for a similar reason.
    Simply changing the access privileges on the folders of a given user may provide access to the files within those folders, but does not change the access privileges on the individual files within such: you may be able to see the files, but not use them. This depends on the application. Additionally, applications often expect to find their specific content in a specific location, usually one owned by the user who created the content.
    ITunes and iPhoto have generally been designed as single-user applications. Despite Mac OS X being a multi-user operating system, Apple did not initially consider the idea of a "family" computer where a family would all share and update common music or photo libraries.
    Some of these issues have been addressed, albeit IMO somewhat inadequately, by adding content-sharing functions to recent versions of iTunes and iPhoto. This was primarily for sharing content over a local network, but these methods also work between users on the same Mac. You can find relevant information by searching the Help for iTunes and iPhoto. In iTunes, select Help > iTunes Help. In iPhoto, select Help > iPhoto Help.
    The downside of these approaches are the requirements they place on the account sharing its music or photos. Specifically, that account must be:
    1. Logged in, and...
    2. The specific application -- iTunes, iPhoto -- must be running to share its content.
    These functions also place limitations on what you can do with shared content, delineated in the "About" documents you will find in the Help related to sharing.
    More sophisticated methods for sharing iTunes music, iPhoto photos, iMovie projects, and other application-specific files between users on the same Mac are generallly found in magazine articles or by searching the Web. A good site to search is Mac OS X Hints. You can also search or post on the iTunes Discussion, iPhoto Discussion, etc. for additional ideas.
    Two useful magazine articles in praticular:
    • The June 2006 issue of MacWorld also had some suggestions on iPhoto sharing that could also be applied to iTunes. That article is currently online: see "One iPhoto, many users."
    • The article "Share Files and Apps with Multiple Users" by Fong and Willams in the August 2004 issue of MacAddict discussed techniques that generally involve the use of the Shared folder and UNIX symbolic links. You can order back issues of MacAddict by contacting their customer service office.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • Can I share Attributes/Variables between 2 different Class Driver Sessions?

    I am designing a Simulator of Instrumentation following these steps:
    1) re-programming, re-compiling, and re-building the DLLs from the advanced class simulation drivers included in IVI Driver Toolset 2.0 using LabWindows/CVI 7.0;
    2) then i create a VI in LabVIEW 7.0 which calls an IVI Class Driver obtaining the desired simulated output data.
    My problem is that I need to share variables between different DLLs in LabVIEW.
    I want to simulate a circuit which consists of a battery and a resistor. I've got 2 instruments: a DC Power Supply and a Digital Multimeter.
    The DC Power Supply acts as the battery providing a certain voltage level, and the Multimeter measures the Voltage and the Current in the resistor.
    I've designed a VI in LabVIEW which uses 2 different sessions: one which calls the class driver IviDCPwr, and the other one which calls IviDmm.
    I wish to be able to access the attributes from "nisDCPwr.c" in the file "nisDmm.c".
    For example, to write a line like this:
    Ivi_GetAttributeViReal64 (ViSession vi, ViConstString channelName, NISDCPWR_ATTR_MEASUREMENT_BASEV, 0, &reading));
    inside the source code "nisDmm.c" of the advanced class simulation driver.
    The problem is that the only ViSession accessible from nisDmm is the handle from the Digital Multimeter, but not from DC Power Supply.
    Would this be possible? Is it "legal"?
    I've tried another approach through the declaration of external variables, but unfortunately I get a run-time error in LabVIEW.
    The only solution I've found is using auxiliary files going between, through the functions included in the Low Level I/O Library .
    Nevertheless, the solution proposed above would result much more convenient, faster and safer in my application.
    I hope everyone has understood my question, and anyone can help.
    THANK YOU VERY MUCH FOR YOUR TIME!!!

    Doesn't anyone have an answer?
    Or any proposal?
    Or even a clue?
    THANKS!

  • How do i share iPhoto library between two user accounts

    I need to share my iphoto pictures between two accounts on the same computer

    For iPhoto 09 (version 8.0.2) and later:
    What you mean by 'share'.
    If you want the other user to be able to see the pics, but not add to, change or alter your library, then enable Sharing in your iPhoto (Preferences -> Sharing), leave iPhoto running and use Fast User Switching to open the other account. In that account, enable 'Look For Shared Libraries'. Your Library will appear in the other source pane.
    Any user can drag a pic from the Shared Library to their own in the iPhoto Window.
    Remember iPhoto must be running in both accounts for this to work.
    If you want the other user to have the same access to the library as you: to be able to add, edit, organise, keyword etc.
    Quit iPhoto in both accounts. Move the Library to the Users / Shared Folder
    (You can also use an external HD set to ignore permissions, a Disk Image or even partition your Hard Disk.)
    In each account in turn: Double click on the Library to open it. (You may be asked to repair the Library Permissions.) From that point on, this will be the default library location. Both accounts will have full access to the library, in fact, both accounts will 'own' it.
    However, there is a catch with this system and it is a significant one. iPhoto is not a multi-user app., it does not have the code to negotiate two users simultaneously writing to the database, and trying will cause db corruption. So only one user at a time, and back up, back up back up.

Maybe you are looking for

  • Problems with sender IDoc scenario

    hi experts.., when i create message Interface for a Outbound Idoc my scenario is not working. if i use idoc directly instead of message interface its working properly And in Interface Determination if i gv interface mapping we are gting errors and wi

  • 1.1.0.315 Upgrade Wreaked Havoc on My Contacts

    I installed the1.1.0.315 upgrade a couple of weeks ago, and after roughly 48 hours of absolute chaos (affecting emails, calendar, etc.), my contacts remain scewed up.  Texts from my oldest friend are showing up as if they came from my most important

  • Merge - 2nd Level Navigation

    Hi there Would really appreciate it if someone out there can put me out my misery. Here follows the problem ... The requirement on this project is to have really fine control over which reports users are shown. To this end, reports (iviews) are assig

  • Sync not working in 10.5

    Hi, when syncing music on my iphone4 and itunes the sync cancels on its own,  not all music gets transferred to my iphone. apps work, films work, tv works, everything except music. any ideas?

  • R3-XI-SRM Scenario

    Hi there, We want to routhe orders05 from our R3 system to SRM via XI.  We tried by using receiver IDOC adapter, but it failed because XI wasn't able to get the metadata from SRM. What is the best way of sending orders05 from xi to SRM? Any help is a