catoken.java

来自「一套JAVA的CA证书签发系统.」· Java 代码 · 共 86 行

JAVA
86
字号
/************************************************************************* *                                                                       * *  EJBCA: The OpenSource Certificate Authority                          * *                                                                       * *  This software is free software; you can redistribute it and/or       * *  modify it under the terms of the GNU Lesser General Public           * *  License as published by the Free Software Foundation; either         * *  version 2.1 of the License, or any later version.                    * *                                                                       * *  See terms of license at gnu.org.                                     * *                                                                       * *************************************************************************/ package se.anatom.ejbca.ca.caadmin;import java.security.PrivateKey;import java.security.PublicKey;import se.anatom.ejbca.ca.exception.CATokenAuthenticationFailedException;import se.anatom.ejbca.ca.exception.CATokenOfflineException;import se.anatom.ejbca.util.UpgradeableDataHashMap;/** Handles maintenance of the device producing signatures and handling the private key. *  * @version $Id: CAToken.java,v 1.6 2004/05/10 04:35:10 herrvendil Exp $ */public abstract class CAToken extends UpgradeableDataHashMap implements java.io.Serializable{        public static final String CATOKENTYPE = "catokentype";        protected static final String SIGNATUREALGORITHM = "signaturealgorithm";   /**    *  Returns information about this CAToken.    */    public abstract CATokenInfo getCATokenInfo();         /**    * Updates the CAToken data saved in database.    */    public abstract void updateCATokenInfo(CATokenInfo catokeninfo);    /**     * Method used to activate HardCATokens when connected after being offline.     *      * @param authenticationcode used to unlock catoken, i.e PIN for smartcard HSMs     * @throws CATokenOfflineException if CAToken is not available or connected.     * @throws CATokenAuthenticationFailedException with error message if authentication to HardCATokens fail.     */    public abstract void activate(String authenticationcode) throws CATokenAuthenticationFailedException, CATokenOfflineException;        /**     * Method used to deactivate HardCATokens.      * Used to set a CAToken too offline status and to reset the HSMs authorization code.     *      * @return true if deactivation was successful.     */    public abstract boolean deactivate();              /** Returns the private key (if possible) of token.    *    * @param purpose should be SecConst.CAKEYPURPOSE_CERTSIGN, SecConst.CAKEYPURPOSE_CRLSIGN or SecConst.CAKEYPURPOSE_KEYENCRYPT     * @throws CATokenOfflineException if CAToken is not available or connected.    * @return PrivateKey object    */    public abstract PrivateKey getPrivateKey(int purpose)  throws CATokenOfflineException;   /** Returns the public key (if possible) of token.    *    * @param purpose should be SecConst.CAKEYPURPOSE_CERTSIGN, SecConst.CAKEYPURPOSE_CRLSIGN or SecConst.CAKEYPURPOSE_KEYENCRYPT        * @throws CATokenOfflineException if CAToken is not available or connected.    * @return PublicKey object    */    public abstract PublicKey getPublicKey(int purpose) throws CATokenOfflineException;            /** Returns the signature Provider that should be used to sign things with     *  the PrivateKey object returned by this signingdevice implementation.     * @return String the name of the Provider     */    public abstract String getProvider();    }

⌨️ 快捷键说明

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