⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jibappletmanagercardservice.java

📁 这是一个以JAVA编写的程序,本人还没有试过,是一个简单的温度控制系统
💻 JAVA
字号:
/*--------------------------------------------------------------------------- * Copyright (C) 1999,2000 Dallas Semiconductor Corporation, All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Except as contained in this notice, the name of Dallas Semiconductor * shall not be used except as stated in the Dallas Semiconductor * Branding Policy. *--------------------------------------------------------------------------- */package com.dalsemi.onewire.jib.service;import opencard.opt.applet.mgmt.*;import opencard.opt.applet.*;import opencard.opt.security.*;import opencard.core.service.*;import opencard.core.terminal.*;import com.dalsemi.onewire.container.*;/** * <p>The <code>JiBAppletManagerCardService</code> implements a set * of calls for the maintenance of multiple applets on a card. * This includes creating, registering and deleting applets on a * multi-applet smartcard.</p> * * <p>There is also a means to load applets onto cards through the <code>installApplet</code> * method.  However, this has not yet been fully specified by OpenCard so now remains * unimplemented in this class.</p> * * @author   K * * @see JiBAppletAccessCardService * @see JiBCardServiceFactory */public class JiBAppletManagerCardService extends JiBAppletAccessCardService implements AppletManagerCardService{    /**     * <p>Install an applet on the smart card.</p>     *     *  <b><i>Note: This method is not implemented</i></b>.  Use the methods available in     *    {@link com.dalsemi.onewire.container.OneWireContainer16 OneWireContainer16}     *    to load an applet onto a Java Powered <u>i</u>Button.     *     * @param    appletCode     *           The <code>AppletCode</code> representing the applet     *           to be installed.     */    public AppletInfo installApplet(AppletCode appletCode) throws CardServiceException, CardTerminalException    {        //must assume that applet code is a JiBAppletCode that has a getBytes method or a getInputStream method        //OR we could make it really cool and make it call into BuildJiblet and everything...just give me the        //names of the classes/directories involved, the database, the output file and we can do it...        return null;    }    /**     * <p>Register an applet on the smart card.  On the Java Powered <u>i</u>Button,     * this is equivalent to a 'select'.</p>     *     * @param    appletID     *           An <code>AppletID</code> representing the applet to be registered.     * @exception opencard.core.service.CardServiceException     *            Thrown when error occurs during execution of the operation.     */    public AppletInfo registerApplet(AppletID appletID) throws CardServiceException, CardTerminalException    {        //i guess this is the same as a select applet???        return select_or_delete(appletID, true);    }    /**     * Remove an applet from the smart card.<p>     *     * @param    appletIdentifier     *           The <code>AppletID</code> object referring to the applet     *           to be removed.     * @exception opencard.core.service.CardServiceException     *            Thrown when error occurs during execution of the operation.     */    public AppletInfo removeApplet(AppletID appletID) throws CardServiceException, CardTerminalException    {        return select_or_delete(appletID, false);    }    //just sharing some code here, only difference is we wanted select or delete    private AppletInfo select_or_delete(AppletID appletID, boolean select)        throws CardServiceException, CardTerminalException    {        if (owc16==null)            initContainer();        byte[] nm = appletID.getBytes();        String name = (new String(nm,1,16)).trim();        try        {            com.dalsemi.onewire.container.ResponseAPDU ds_rapdu = null;            owc16.getAdapter().beginExclusive(true);            owc16.getAdapter().setSpeed(com.dalsemi.onewire.adapter.DSPortAdapter.SPEED_REGULAR);            if (select)                 ds_rapdu = owc16.select(name);            else                 ds_rapdu = owc16.deleteAppletByAID(name);            owc16.getAdapter().endExclusive();            if (ds_rapdu.getSW()==0x9000)            {                AppletInfo info = new AppletInfo();                AppletID copy = new AppletID((byte[])appletID.getBytes().clone());                info.setAppletID(copy);                info.setLabel((new String(copy.getBytes(),1,16)).trim());                return info;            }            else            {                throw new CardServiceException(com.dalsemi.onewire.jib.SWInterpreter.interpret(ds_rapdu.getSW()));            }        }        catch(com.dalsemi.onewire.OneWireException e)        {            try            {                owc16.getAdapter().endExclusive();            }            catch(Exception e1)            {            }            throw new CardTerminalException(e.getMessage());        }    }    /**     * This method is not implemented in the current <code>JibAppletManagerCardService</code>.     *     */    public void provideCredentials(SecurityDomain domain, CredentialBag creds) throws CardServiceException    {    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -