jdk/src/share/classes/sun/security/pkcs11/wrapper/PKCS11.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 17477 09aab50cf738
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
     2
 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
/* Copyright  (c) 2002 Graz University of Technology. All rights reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * Redistribution and use in  source and binary forms, with or without
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * modification, are permitted  provided that the following conditions are met:
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * 1. Redistributions of  source code must retain the above copyright notice,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 *    this list of conditions and the following disclaimer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * 2. Redistributions in  binary form must reproduce the above copyright notice,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *    this list of conditions and the following disclaimer in the documentation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *    and/or other materials provided with the distribution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 3. The end-user documentation included with the redistribution, if any, must
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *    include the following acknowledgment:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *    "This product includes software developed by IAIK of Graz University of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 *     Technology."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 *    Alternately, this acknowledgment may appear in the software itself, if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 *    and wherever such third-party acknowledgments normally appear.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 * 4. The names "Graz University of Technology" and "IAIK of Graz University of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *    Technology" must not be used to endorse or promote products derived from
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *    this software without prior written permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * 5. Products derived from this software may not be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *    "IAIK PKCS Wrapper", nor may "IAIK" appear in their name, without prior
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *    written permission of Graz University of Technology.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *  OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *  POSSIBILITY  OF SUCH DAMAGE.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
package sun.security.pkcs11.wrapper;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * This is the default implementation of the PKCS11 interface. IT connects to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * the pkcs11wrapper.dll file, which is the native part of this library.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * The strange and awkward looking initialization was chosen to avoid calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * loadLibrary from a static initialization block, because this would complicate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * the use in applets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * @author Karl Scheibelhofer <Karl.Scheibelhofer@iaik.at>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * @author Martin Schlaeffer <schlaeff@sbox.tugraz.at>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * @invariants (pkcs11ModulePath_ <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
public class PKCS11 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * The name of the native part of the wrapper; i.e. the filename without
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * the extension (e.g. ".DLL" or ".so").
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    private static final String PKCS11_WRAPPER = "j2pkcs11";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        // cannot use LoadLibraryAction because that would make the native
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        // library available to the bootclassloader, but we run in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        // extension classloader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        AccessController.doPrivileged(new PrivilegedAction<Object>() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
            public Object run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                System.loadLibrary(PKCS11_WRAPPER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        });
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        initializeLibrary();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    public static void loadNative() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        // dummy method that can be called to make sure the native
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        // portion has been loaded. actual loading happens in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        // static initializer, hence this method is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * The PKCS#11 module to connect to. This is the PKCS#11 driver of the token;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * e.g. pk2priv.dll.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    private final String pkcs11ModulePath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    private long pNativeData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * This method does the initialization of the native library. It is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * exactly once for this class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    private static native void initializeLibrary();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    // XXX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * This method does the finalization of the native library. It is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * exactly once for this class. The library uses this method for a clean-up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * of any resources.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    private static native void finalizeLibrary();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    private static final Map<String,PKCS11> moduleMap =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        new HashMap<String,PKCS11>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * Connects to the PKCS#11 driver given. The filename must contain the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * path, if the driver is not in the system's search path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param pkcs11ModulePath the PKCS#11 library path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @preconditions (pkcs11ModulePath <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   136
    PKCS11(String pkcs11ModulePath, String functionListName)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   137
            throws IOException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        connect(pkcs11ModulePath, functionListName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        this.pkcs11ModulePath = pkcs11ModulePath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   142
    public static synchronized PKCS11 getInstance(String pkcs11ModulePath,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   143
            String functionList, CK_C_INITIALIZE_ARGS pInitArgs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   144
            boolean omitInitialize) throws IOException, PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        // we may only call C_Initialize once per native .so/.dll
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        // so keep a cache using the (non-canonicalized!) path
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        PKCS11 pkcs11 = moduleMap.get(pkcs11ModulePath);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        if (pkcs11 == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            if ((pInitArgs != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                    && ((pInitArgs.flags & CKF_OS_LOCKING_OK) != 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                pkcs11 = new PKCS11(pkcs11ModulePath, functionList);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                pkcs11 = new SynchronizedPKCS11(pkcs11ModulePath, functionList);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            if (omitInitialize == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                    pkcs11.C_Initialize(pInitArgs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                } catch (PKCS11Exception e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                    // ignore already-initialized error code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                    // rethrow all other errors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                    if (e.getErrorCode() != CKR_CRYPTOKI_ALREADY_INITIALIZED) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                        throw e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            moduleMap.put(pkcs11ModulePath, pkcs11);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        return pkcs11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Connects this object to the specified PKCS#11 library. This method is for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * internal use only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Declared private, because incorrect handling may result in errors in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * native part.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param pkcs11ModulePath The PKCS#11 library path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @preconditions (pkcs11ModulePath <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   181
    private native void connect(String pkcs11ModulePath, String functionListName)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   182
            throws IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * Disconnects the PKCS#11 library from this object. After calling this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * method, this object is no longer connected to a native PKCS#11 module
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * and any subsequent calls to C_ methods will fail. This method is for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * internal use only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * Declared private, because incorrect handling may result in errors in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * native part.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    private native void disconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    // Implementation of PKCS11 methods delegated to native pkcs11wrapper library
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * General-purpose
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * C_Initialize initializes the Cryptoki library.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * (General-purpose)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * @param pInitArgs if pInitArgs is not NULL it gets casted to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *         CK_C_INITIALIZE_ARGS_PTR and dereferenced
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     *         (PKCS#11 param: CK_VOID_PTR pInitArgs)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    native void C_Initialize(Object pInitArgs) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * C_Finalize indicates that an application is done with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Cryptoki library
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * (General-purpose)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @param pReserved is reserved. Should be NULL_PTR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     *         (PKCS#11 param: CK_VOID_PTR pReserved)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @preconditions (pReserved == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public native void C_Finalize(Object pReserved) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * C_GetInfo returns general information about Cryptoki.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * (General-purpose)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @return the information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     *         (PKCS#11 param: CK_INFO_PTR pInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    public native CK_INFO C_GetInfo() throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * Slot and token management
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * C_GetSlotList obtains a list of slots in the system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @param tokenPresent if true only Slot IDs with a token are returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     *         (PKCS#11 param: CK_BBOOL tokenPresent)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @return a long array of slot IDs and number of Slot IDs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     *         (PKCS#11 param: CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   260
    public native long[] C_GetSlotList(boolean tokenPresent)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   261
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * C_GetSlotInfo obtains information about a particular slot in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * the system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * @param slotID the ID of the slot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @return the slot information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *         (PKCS#11 param: CK_SLOT_INFO_PTR pInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    public native CK_SLOT_INFO C_GetSlotInfo(long slotID) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * C_GetTokenInfo obtains information about a particular token
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * in the system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @param slotID ID of the token's slot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * @return the token information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     *         (PKCS#11 param: CK_TOKEN_INFO_PTR pInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   293
    public native CK_TOKEN_INFO C_GetTokenInfo(long slotID)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   294
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * C_GetMechanismList obtains a list of mechanism types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * supported by a token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @param slotID ID of the token's slot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @return a long array of mechanism types and number of mechanism types
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *         (PKCS#11 param: CK_MECHANISM_TYPE_PTR pMechanismList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     *                         CK_ULONG_PTR pulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    public native long[] C_GetMechanismList(long slotID) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * C_GetMechanismInfo obtains information about a particular
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * mechanism possibly supported by a token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @param slotID ID of the token's slot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @param type type of mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     *         (PKCS#11 param: CK_MECHANISM_TYPE type)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @return the mechanism info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     *         (PKCS#11 param: CK_MECHANISM_INFO_PTR pInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   329
    public native CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   330
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * C_InitToken initializes a token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * @param slotID ID of the token's slot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * @param pPin the SO's initial PIN and the length in bytes of the PIN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *         (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @param pLabel 32-byte token label (blank padded)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *         (PKCS#11 param: CK_UTF8CHAR_PTR pLabel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   347
//    public native void C_InitToken(long slotID, char[] pPin, char[] pLabel)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   348
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * C_InitPIN initializes the normal user's PIN.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @param pPin the normal user's PIN and the length in bytes of the PIN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *         (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   363
//    public native void C_InitPIN(long hSession, char[] pPin)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   364
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * C_SetPIN modifies the PIN of the user who is logged in.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * (Slot and token management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * @param pOldPin the old PIN and the length of the old PIN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     *         (PKCS#11 param: CK_CHAR_PTR pOldPin, CK_ULONG ulOldLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @param pNewPin the new PIN and the length of the new PIN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     *         (PKCS#11 param: CK_CHAR_PTR pNewPin, CK_ULONG ulNewLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   381
//    public native void C_SetPIN(long hSession, char[] pOldPin, char[] pNewPin)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   382
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
 * Session management
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * C_OpenSession opens a session between an application and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * @param slotID the slot's ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @param flags of CK_SESSION_INFO
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     *         (PKCS#11 param: CK_FLAGS flags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * @param pApplication passed to callback
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *         (PKCS#11 param: CK_VOID_PTR pApplication)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * @param Notify the callback function
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     *         (PKCS#11 param: CK_NOTIFY Notify)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @return the session handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     *         (PKCS#11 param: CK_SESSION_HANDLE_PTR phSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   409
    public native long C_OpenSession(long slotID, long flags,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   410
            Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * C_CloseSession closes a session between an application and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    public native void C_CloseSession(long hSession) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * C_CloseAllSessions closes all sessions with a token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * @param slotID the ID of the token's slot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     *         (PKCS#11 param: CK_SLOT_ID slotID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
//    public native void C_CloseAllSessions(long slotID) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * C_GetSessionInfo obtains information about the session.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * @return the session info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     *         (PKCS#11 param: CK_SESSION_INFO_PTR pInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   452
    public native CK_SESSION_INFO C_GetSessionInfo(long hSession)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   453
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * C_GetOperationState obtains the state of the cryptographic operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * in a session.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @param hSession session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @return the state and the state length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     *         (PKCS#11 param: CK_BYTE_PTR pOperationState,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     *                         CK_ULONG_PTR pulOperationStateLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   470
    public native byte[] C_GetOperationState(long hSession)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   471
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * C_SetOperationState restores the state of the cryptographic
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * operation in a session.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * @param hSession session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * @param pOperationState the state and the state length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     *         (PKCS#11 param: CK_BYTE_PTR pOperationState,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     *                         CK_ULONG ulOperationStateLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @param hEncryptionKey en/decryption key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     *         (PKCS#11 param: CK_OBJECT_HANDLE hEncryptionKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * @param hAuthenticationKey sign/verify key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     *         (PKCS#11 param: CK_OBJECT_HANDLE hAuthenticationKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   492
    public native void C_SetOperationState(long hSession, byte[] pOperationState,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   493
            long hEncryptionKey, long hAuthenticationKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * C_Login logs a user into a token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * @param userType the user type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     *         (PKCS#11 param: CK_USER_TYPE userType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * @param pPin the user's PIN and the length of the PIN
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     *         (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   510
    public native void C_Login(long hSession, long userType, char[] pPin)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   511
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * C_Logout logs a user out from a token.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * (Session management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    public native void C_Logout(long hSession) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
 * Object management
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * C_CreateObject creates a new object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * @param pTemplate the object's template and number of attributes in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     *         template
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * @return the object's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     *         (PKCS#11 param: CK_OBJECT_HANDLE_PTR phObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   547
    public native long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   548
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * C_CopyObject copies an object, creating a new object for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     * copy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * @param hObject the object's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     *         (PKCS#11 param: CK_OBJECT_HANDLE hObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * @param pTemplate the template for the new object and number of attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     *         in template
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * @return the handle of the copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     *         (PKCS#11 param: CK_OBJECT_HANDLE_PTR phNewObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   569
    public native long C_CopyObject(long hSession, long hObject,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   570
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     * C_DestroyObject destroys an object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * @param hObject the object's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     *         (PKCS#11 param: CK_OBJECT_HANDLE hObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   585
    public native void C_DestroyObject(long hSession, long hObject)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   586
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * C_GetObjectSize gets the size of an object in bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * @param hObject the object's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     *         (PKCS#11 param: CK_OBJECT_HANDLE hObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * @return the size of the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     *         (PKCS#11 param: CK_ULONG_PTR pulSize)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   603
//    public native long C_GetObjectSize(long hSession, long hObject)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   604
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * C_GetAttributeValue obtains the value of one or more object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * attributes. The template attributes also receive the values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * note: in PKCS#11 pTemplate and the result template are the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * @param hObject the object's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     *         (PKCS#11 param: CK_OBJECT_HANDLE hObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * @param pTemplate specifies the attributes and number of attributes to get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     *                  The template attributes also receive the values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * @preconditions (pTemplate <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   624
    public native void C_GetAttributeValue(long hSession, long hObject,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   625
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * C_SetAttributeValue modifies the value of one or more object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     * @param hObject the object's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     *         (PKCS#11 param: CK_OBJECT_HANDLE hObject)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     * @param pTemplate specifies the attributes and values to get; number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     *         attributes in the template
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * @preconditions (pTemplate <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   644
    public native void C_SetAttributeValue(long hSession, long hObject,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   645
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     * C_FindObjectsInit initializes a search for token and session
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * objects that match a template.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * @param pTemplate the object's attribute values to match and the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     *         attributes in search template
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   662
    public native void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   663
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * C_FindObjects continues a search for token and session
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * objects that match a template, obtaining additional object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * handles.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * @param ulMaxObjectCount the max. object handles to get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     *         (PKCS#11 param: CK_ULONG ulMaxObjectCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * @return the object's handles and the actual number of objects returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     *         (PKCS#11 param: CK_ULONG_PTR pulObjectCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   682
    public native long[] C_FindObjects(long hSession, long ulMaxObjectCount)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   683
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * C_FindObjectsFinal finishes a search for token and session
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     * (Object management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    public native void C_FindObjectsFinal(long hSession) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
 * Encryption and decryption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * C_EncryptInit initializes an encryption operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * @param pMechanism the encryption mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * @param hKey the handle of the encryption key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   719
    public native void C_EncryptInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   720
            long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     * C_Encrypt encrypts single-part data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * @param pData the data to get encrypted and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     * @return the encrypted data and the encrypted data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
     *                         CK_ULONG_PTR pulEncryptedDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * @preconditions (pData <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   738
    public native int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   739
            byte[] out, int outOfs, int outLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * C_EncryptUpdate continues a multiple-part encryption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * @param pPart the data part to get encrypted and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * @return the encrypted data part and the encrypted data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
                             CK_ULONG_PTR pulEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * @preconditions (pPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   758
    public native int C_EncryptUpdate(long hSession, long directIn, byte[] in,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   759
            int inOfs, int inLen, long directOut, byte[] out, int outOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   760
            int outLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * C_EncryptFinal finishes a multiple-part encryption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * @return the last encrypted data part and the last data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     *         (PKCS#11 param: CK_BYTE_PTR pLastEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
                             CK_ULONG_PTR pulLastEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   777
    public native int C_EncryptFinal(long hSession, long directOut, byte[] out,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   778
            int outOfs, int outLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * C_DecryptInit initializes a decryption operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * @param pMechanism the decryption mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     * @param hKey the handle of the decryption key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   795
    public native void C_DecryptInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   796
            long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * C_Decrypt decrypts encrypted data in a single part.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * @param pEncryptedData the encrypted data to get decrypted and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     *         encrypted data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     *                         CK_ULONG ulEncryptedDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     * @return the decrypted data and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * @preconditions (pEncryptedPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   815
    public native int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   816
            byte[] out, int outOfs, int outLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * C_DecryptUpdate continues a multiple-part decryption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * @param pEncryptedPart the encrypted data part to get decrypted and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     *         encrypted data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     *                         CK_ULONG ulEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * @return the decrypted data part and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * @preconditions (pEncryptedPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   836
    public native int C_DecryptUpdate(long hSession, long directIn, byte[] in,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   837
            int inOfs, int inLen, long directOut, byte[] out, int outOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   838
            int outLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * C_DecryptFinal finishes a multiple-part decryption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * (Encryption and decryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     * @return the last decrypted data part and the last data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     *         (PKCS#11 param: CK_BYTE_PTR pLastPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     *                         CK_ULONG_PTR pulLastPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   855
    public native int C_DecryptFinal(long hSession, long directOut, byte[] out,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   856
            int outOfs, int outLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
 * Message digesting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     * C_DigestInit initializes a message-digesting operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * (Message digesting)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * @param pMechanism the digesting mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   876
    public native void C_DigestInit(long hSession, CK_MECHANISM pMechanism)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   877
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
    // note that C_DigestSingle does not exist in PKCS#11
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
    // we combined the C_DigestInit and C_Digest into a single function
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    // to save on Java<->C transitions and save 5-10% on small digests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
    // this made the C_Digest method redundant, it has been removed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
     * C_Digest digests data in a single part.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     * (Message digesting)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * @param data the data to get digested and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * @return the message digest and the length of the message digest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     *         (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * @preconditions (data <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   898
    public native int C_DigestSingle(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   899
            byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   900
            int digestLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     * C_DigestUpdate continues a multiple-part message-digesting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     * (Message digesting)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * @param pPart the data to get digested and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * @preconditions (pPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   916
    public native void C_DigestUpdate(long hSession, long directIn, byte[] in,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   917
            int inOfs, int inLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
     * C_DigestKey continues a multi-part message-digesting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
     * operation, by digesting the value of a secret key as part of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * the data already digested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * (Message digesting)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     * @param hKey the handle of the secret key to be digested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   934
    public native void C_DigestKey(long hSession, long hKey)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   935
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * C_DigestFinal finishes a multiple-part message-digesting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * (Message digesting)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * @return the message digest and the length of the message digest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     *         (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   951
    public native int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   952
            int digestLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
 * Signing and MACing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
     * C_SignInit initializes a signature (private key encryption)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     * operation, where the signature is (will be) an appendix to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
     * the data, and plaintext cannot be recovered from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     * signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * @param pMechanism the signature mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * @param hKey the handle of the signature key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   977
    public native void C_SignInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   978
            long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * C_Sign signs (encrypts with private key) data in a single
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * part, where the signature is (will be) an appendix to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     * data, and plaintext cannot be recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
     * @param pData the data to sign and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
     * @return the signature and the signature's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     *         (PKCS#11 param: CK_BYTE_PTR pSignature,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     *                         CK_ULONG_PTR pulSignatureLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * @preconditions (pData <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   998
    public native byte[] C_Sign(long hSession, byte[] pData)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
   999
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     * C_SignUpdate continues a multiple-part signature operation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     * where the signature is (will be) an appendix to the data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * and plaintext cannot be recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
     * @param pPart the data part to sign and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     * @preconditions (pPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1016
    public native void C_SignUpdate(long hSession, long directIn, byte[] in,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1017
            int inOfs, int inLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     * C_SignFinal finishes a multiple-part signature operation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     * returning the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     * @return the signature and the signature's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     *         (PKCS#11 param: CK_BYTE_PTR pSignature,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     *                         CK_ULONG_PTR pulSignatureLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1034
    public native byte[] C_SignFinal(long hSession, int expectedLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1035
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     * C_SignRecoverInit initializes a signature operation, where
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     * the data can be recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
     * @param pMechanism the signature mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
     * @param hKey the handle of the signature key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1053
    public native void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1054
            long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * C_SignRecover signs data in a single operation, where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * data can be recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
     * @param pData the data to sign and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
     * @return the signature and the signature's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
     *         (PKCS#11 param: CK_BYTE_PTR pSignature,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
     *                         CK_ULONG_PTR pulSignatureLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
     * @preconditions (pData <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1073
    public native int C_SignRecover(long hSession, byte[] in, int inOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1074
            int inLen, byte[] out, int outOufs, int outLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1075
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
 * Verifying signatures and MACs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
     * C_VerifyInit initializes a verification operation, where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
     * signature is an appendix to the data, and plaintext cannot
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
     * cannot be recovered from the signature (e.g. DSA).
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
     * @param pMechanism the verification mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * @param hKey the handle of the verification key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1099
    public native void C_VerifyInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1100
            long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
     * C_Verify verifies a signature in a single-part operation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
     * where the signature is an appendix to the data, and plaintext
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
     * cannot be recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
     * @param pData the signed data and the signed data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG ulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
     * @param pSignature the signature to verify and the signature's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
     *         (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
     * @preconditions (pData <> null) and (pSignature <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1119
    public native void C_Verify(long hSession, byte[] pData, byte[] pSignature)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1120
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
     * C_VerifyUpdate continues a multiple-part verification
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
     * operation, where the signature is an appendix to the data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
     * and plaintext cannot be recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
     * @param pPart the signed data part and the signed data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
     * @preconditions (pPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1137
    public native void C_VerifyUpdate(long hSession, long directIn, byte[] in,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1138
            int inOfs, int inLen) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
     * C_VerifyFinal finishes a multiple-part verification
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
     * operation, checking the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
     * @param pSignature the signature to verify and the signature's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
     *         (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     * @preconditions (pSignature <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1154
    public native void C_VerifyFinal(long hSession, byte[] pSignature)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1155
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
     * C_VerifyRecoverInit initializes a signature verification
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
     * operation, where the data is recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
     * @param pMechanism the verification mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
     * @param hKey the handle of the verification key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1173
    public native void C_VerifyRecoverInit(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1174
            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
     * C_VerifyRecover verifies a signature in a single-part
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
     * operation, where the data is recovered from the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
     * (Signing and MACing)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
     * @param pSignature the signature to verify and the signature's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
     *         (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
     * @return the recovered data and the recovered data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
     *         (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
     * @preconditions (pSignature <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1192
    public native int C_VerifyRecover(long hSession, byte[] in, int inOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1193
            int inLen, byte[] out, int outOufs, int outLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1194
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
 * Dual-function cryptographic operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
     * C_DigestEncryptUpdate continues a multiple-part digesting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
     * and encryption operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
     * (Dual-function cryptographic operations)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
     * @param pPart the data part to digest and to encrypt and the data's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
     * @return the digested and encrypted data part and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
     *                         CK_ULONG_PTR pulEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
     * @preconditions (pPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1218
//    public native byte[] C_DigestEncryptUpdate(long hSession, byte[] pPart)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1219
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
     * C_DecryptDigestUpdate continues a multiple-part decryption and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
     * digesting operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
     * (Dual-function cryptographic operations)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
     * @param pEncryptedPart the encrypted data part to decrypt and to digest
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
     *         and encrypted data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
     *                         CK_ULONG ulEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
     * @return the decrypted and digested data part and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
     * @preconditions (pEncryptedPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1239
//    public native byte[] C_DecryptDigestUpdate(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1240
//            byte[] pEncryptedPart) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
     * C_SignEncryptUpdate continues a multiple-part signing and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
     * encryption operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
     * (Dual-function cryptographic operations)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
     * @param pPart the data part to sign and to encrypt and the data part's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
     *         length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
     * @return the signed and encrypted data part and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
     *                         CK_ULONG_PTR pulEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
     * @preconditions (pPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1260
//    public native byte[] C_SignEncryptUpdate(long hSession, byte[] pPart)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1261
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
     * C_DecryptVerifyUpdate continues a multiple-part decryption and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
     * verify operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
     * (Dual-function cryptographic operations)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
     * @param pEncryptedPart the encrypted data part to decrypt and to verify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
     *         and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
     *         (PKCS#11 param: CK_BYTE_PTR pEncryptedPart,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
     *                         CK_ULONG ulEncryptedPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
     * @return the decrypted and verified data part and the data part's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
     *         (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
     * @preconditions (pEncryptedPart <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1281
//    public native byte[] C_DecryptVerifyUpdate(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1282
//            byte[] pEncryptedPart) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
 * Key management
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
     * C_GenerateKey generates a secret key, creating a new key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
     * (Key management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
     * @param pMechanism the key generation mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
     * @param pTemplate the template for the new key and the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
     *         attributes in the template
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
     * @return the handle of the new key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
     *         (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1308
    public native long C_GenerateKey(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1309
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
     * C_GenerateKeyPair generates a public-key/private-key pair,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
     * creating new key objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
     * (Key management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
     * @param pMechanism the key generation mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
     * @param pPublicKeyTemplate the template for the new public key and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
     *         number of attributes in the template
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pPublicKeyTemplate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
     *                         CK_ULONG ulPublicKeyAttributeCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
     * @param pPrivateKeyTemplate the template for the new private key and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
     *         number of attributes in the template
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pPrivateKeyTemplate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
     *                         CK_ULONG ulPrivateKeyAttributeCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
     * @return a long array with exactly two elements and the public key handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
     *         as the first element and the private key handle as the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
     *         element
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
     *         (PKCS#11 param: CK_OBJECT_HANDLE_PTR phPublicKey,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
     *                         CK_OBJECT_HANDLE_PTR phPrivateKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
     * @preconditions (pMechanism <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
     * @postconditions (result <> null) and (result.length == 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
    public native long[] C_GenerateKeyPair(long hSession,
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1339
            CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pPublicKeyTemplate,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1340
            CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
     * C_WrapKey wraps (i.e., encrypts) a key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
     * (Key management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
     * @param pMechanism the wrapping mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
     * @param hWrappingKey the handle of the wrapping key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
     *         (PKCS#11 param: CK_OBJECT_HANDLE hWrappingKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
     * @param hKey the handle of the key to be wrapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
     *         (PKCS#11 param: CK_OBJECT_HANDLE hKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
     * @return the wrapped key and the length of the wrapped key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
     *         (PKCS#11 param: CK_BYTE_PTR pWrappedKey,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
     *                         CK_ULONG_PTR pulWrappedKeyLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
     * @postconditions (result <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1363
    public native byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1364
            long hWrappingKey, long hKey) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
     * C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
     * key object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
     * (Key management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
     * @param pMechanism the unwrapping mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
     * @param hUnwrappingKey the handle of the unwrapping key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
     *         (PKCS#11 param: CK_OBJECT_HANDLE hUnwrappingKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
     * @param pWrappedKey the wrapped key to unwrap and the wrapped key's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
     *         (PKCS#11 param: CK_BYTE_PTR pWrappedKey, CK_ULONG ulWrappedKeyLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
     * @param pTemplate the template for the new key and the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
     *         attributes in the template
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
     * @return the handle of the unwrapped key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
     *         (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
     * @preconditions (pWrappedKey <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
    public native long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism,
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1390
            long hUnwrappingKey, byte[] pWrappedKey, CK_ATTRIBUTE[] pTemplate)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1391
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
     * C_DeriveKey derives a key from a base key, creating a new key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
     * (Key management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
     * @param pMechanism the key derivation mechanism
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
     *         (PKCS#11 param: CK_MECHANISM_PTR pMechanism)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
     * @param hBaseKey the handle of the base key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
     *         (PKCS#11 param: CK_OBJECT_HANDLE hBaseKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
     * @param pTemplate the template for the new key and the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
     *         attributes in the template
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
     *         (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
     * @return the handle of the derived key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
     *         (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
    public native long C_DeriveKey(long hSession, CK_MECHANISM pMechanism,
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1415
            long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
 * Random number generation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
     * C_SeedRandom mixes additional seed material into the token's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
     * random number generator.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
     * (Random number generation)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
     * @param pSeed the seed material and the seed material's length
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
     *         (PKCS#11 param: CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
     * @preconditions (pSeed <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1436
    public native void C_SeedRandom(long hSession, byte[] pSeed)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1437
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
     * C_GenerateRandom generates random data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
     * (Random number generation)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
     * @param RandomData receives the random data and the length of RandomData
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
     *         is the length of random data to be generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
     *         (PKCS#11 param: CK_BYTE_PTR pRandomData, CK_ULONG ulRandomLen)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
     * @preconditions (randomData <> null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1453
    public native void C_GenerateRandom(long hSession, byte[] randomData)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1454
            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
 * Parallel function management
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
     * C_GetFunctionStatus is a legacy function; it obtains an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
     * updated status of a function running in parallel with an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
     * application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
     * (Parallel function management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1474
//    public native void C_GetFunctionStatus(long hSession)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1475
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
     * C_CancelFunction is a legacy function; it cancels a function
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
     * running in parallel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
     * (Parallel function management)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
     * @param hSession the session's handle
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
     *         (PKCS#11 param: CK_SESSION_HANDLE hSession)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
     * @preconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
//    public native void C_CancelFunction(long hSession) throws PKCS11Exception;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
/* *****************************************************************************
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
 * Functions added in for Cryptoki Version 2.01 or later
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
 ******************************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
     * C_WaitForSlotEvent waits for a slot event (token insertion,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
     * removal, etc.) to occur.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
     * (General-purpose)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
     * @param flags blocking/nonblocking flag
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
     *         (PKCS#11 param: CK_FLAGS flags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
     * @param pReserved reserved. Should be null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
     *         (PKCS#11 param: CK_VOID_PTR pReserved)
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 17477
diff changeset
  1506
     * @return the slot ID where the event occurred
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
     *         (PKCS#11 param: CK_SLOT_ID_PTR pSlot)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
     * @exception PKCS11Exception If function returns other value than CKR_OK.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
     * @preconditions (pRserved == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
     * @postconditions
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
     */
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1512
//    public native long C_WaitForSlotEvent(long flags, Object pRserved)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1513
//            throws PKCS11Exception;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
     * Returns the string representation of this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
     * @return The string representation of object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
        return "Module name: " + pkcs11ModulePath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
     * Calls disconnect() to cleanup the native part of the wrapper. Once this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
     * method is called, this object cannot be used any longer. Any subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
     * call to a C_* method will result in a runtime exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
     * @exception Throwable If finalization fails.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
     */
17477
09aab50cf738 8010134: A finalizer in sun.security.pkcs11.wrapper.PKCS11 perhaps should be protected
valeriep
parents: 16734
diff changeset
  1531
    protected void finalize() throws Throwable {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
        disconnect();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
// PKCS11 subclass that has all methods synchronized and delegating to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
// parent. Used for tokens that only support single threaded access
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
static class SynchronizedPKCS11 extends PKCS11 {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1539
    SynchronizedPKCS11(String pkcs11ModulePath, String functionListName)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1540
            throws IOException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
        super(pkcs11ModulePath, functionListName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
    synchronized void C_Initialize(Object pInitArgs) throws PKCS11Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
        super.C_Initialize(pInitArgs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1548
    public synchronized void C_Finalize(Object pReserved)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1549
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
        super.C_Finalize(pReserved);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
    public synchronized CK_INFO C_GetInfo() throws PKCS11Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
        return super.C_GetInfo();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1557
    public synchronized long[] C_GetSlotList(boolean tokenPresent)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1558
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
        return super.C_GetSlotList(tokenPresent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1562
    public synchronized CK_SLOT_INFO C_GetSlotInfo(long slotID)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1563
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
        return super.C_GetSlotInfo(slotID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1567
    public synchronized CK_TOKEN_INFO C_GetTokenInfo(long slotID)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1568
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
        return super.C_GetTokenInfo(slotID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1572
    public synchronized long[] C_GetMechanismList(long slotID)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1573
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
        return super.C_GetMechanismList(slotID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1577
    public synchronized CK_MECHANISM_INFO C_GetMechanismInfo(long slotID,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1578
            long type) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
        return super.C_GetMechanismInfo(slotID, type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1582
    public synchronized long C_OpenSession(long slotID, long flags,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1583
            Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
        return super.C_OpenSession(slotID, flags, pApplication, Notify);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1587
    public synchronized void C_CloseSession(long hSession)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1588
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
        super.C_CloseSession(hSession);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1592
    public synchronized CK_SESSION_INFO C_GetSessionInfo(long hSession)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1593
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
        return super.C_GetSessionInfo(hSession);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1597
    public synchronized void C_Login(long hSession, long userType, char[] pPin)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1598
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
        super.C_Login(hSession, userType, pPin);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
    public synchronized void C_Logout(long hSession) throws PKCS11Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
        super.C_Logout(hSession);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1606
    public synchronized long C_CreateObject(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1607
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
        return super.C_CreateObject(hSession, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1611
    public synchronized long C_CopyObject(long hSession, long hObject,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1612
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
        return super.C_CopyObject(hSession, hObject, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1616
    public synchronized void C_DestroyObject(long hSession, long hObject)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1617
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
        super.C_DestroyObject(hSession, hObject);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1621
    public synchronized void C_GetAttributeValue(long hSession, long hObject,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1622
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
        super.C_GetAttributeValue(hSession, hObject, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1626
    public synchronized void C_SetAttributeValue(long hSession, long hObject,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1627
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
        super.C_SetAttributeValue(hSession, hObject, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1631
    public synchronized void C_FindObjectsInit(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1632
            CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
        super.C_FindObjectsInit(hSession, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1636
    public synchronized long[] C_FindObjects(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1637
            long ulMaxObjectCount) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
        return super.C_FindObjects(hSession, ulMaxObjectCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1641
    public synchronized void C_FindObjectsFinal(long hSession)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1642
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
        super.C_FindObjectsFinal(hSession);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1646
    public synchronized void C_EncryptInit(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1647
            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
        super.C_EncryptInit(hSession, pMechanism, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1651
    public synchronized int C_Encrypt(long hSession, byte[] in, int inOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1652
            int inLen, byte[] out, int outOfs, int outLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1653
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
        return super.C_Encrypt(hSession, in, inOfs, inLen, out, outOfs, outLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1657
    public synchronized int C_EncryptUpdate(long hSession, long directIn,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1658
            byte[] in, int inOfs, int inLen, long directOut, byte[] out,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1659
            int outOfs, int outLen) throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1660
        return super.C_EncryptUpdate(hSession, directIn, in, inOfs, inLen,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1661
                directOut, out, outOfs, outLen);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1664
    public synchronized int C_EncryptFinal(long hSession, long directOut,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1665
            byte[] out, int outOfs, int outLen) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
        return super.C_EncryptFinal(hSession, directOut, out, outOfs, outLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1669
    public synchronized void C_DecryptInit(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1670
            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
        super.C_DecryptInit(hSession, pMechanism, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1674
    public synchronized int C_Decrypt(long hSession, byte[] in, int inOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1675
            int inLen, byte[] out, int outOfs, int outLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1676
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
        return super.C_Decrypt(hSession, in, inOfs, inLen, out, outOfs, outLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1680
    public synchronized int C_DecryptUpdate(long hSession, long directIn,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1681
            byte[] in, int inOfs, int inLen, long directOut, byte[] out,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1682
            int outOfs, int outLen) throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1683
        return super.C_DecryptUpdate(hSession, directIn, in, inOfs, inLen,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1684
                directOut, out, outOfs, outLen);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1687
    public synchronized int C_DecryptFinal(long hSession, long directOut,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1688
            byte[] out, int outOfs, int outLen) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
        return super.C_DecryptFinal(hSession, directOut, out, outOfs, outLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1692
    public synchronized void C_DigestInit(long hSession, CK_MECHANISM pMechanism)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1693
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
        super.C_DigestInit(hSession, pMechanism);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1697
    public synchronized int C_DigestSingle(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1698
            CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1699
            byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1700
        return super.C_DigestSingle(hSession, pMechanism, in, inOfs, inLen,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1701
                digest, digestOfs, digestLen);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1704
    public synchronized void C_DigestUpdate(long hSession, long directIn,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1705
            byte[] in, int inOfs, int inLen) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
        super.C_DigestUpdate(hSession, directIn, in, inOfs, inLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1709
    public synchronized void C_DigestKey(long hSession, long hKey)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1710
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
        super.C_DigestKey(hSession, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1714
    public synchronized int C_DigestFinal(long hSession, byte[] pDigest,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1715
            int digestOfs, int digestLen) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
        return super.C_DigestFinal(hSession, pDigest, digestOfs, digestLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1719
    public synchronized void C_SignInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1720
            long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
        super.C_SignInit(hSession, pMechanism, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1724
    public synchronized byte[] C_Sign(long hSession, byte[] pData)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1725
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
        return super.C_Sign(hSession, pData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1729
    public synchronized void C_SignUpdate(long hSession, long directIn,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1730
            byte[] in, int inOfs, int inLen) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
        super.C_SignUpdate(hSession, directIn, in, inOfs, inLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1734
    public synchronized byte[] C_SignFinal(long hSession, int expectedLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1735
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
        return super.C_SignFinal(hSession, expectedLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1739
    public synchronized void C_SignRecoverInit(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1740
            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
        super.C_SignRecoverInit(hSession, pMechanism, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1744
    public synchronized int C_SignRecover(long hSession, byte[] in, int inOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1745
            int inLen, byte[] out, int outOufs, int outLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1746
            throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1747
        return super.C_SignRecover(hSession, in, inOfs, inLen, out, outOufs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1748
                outLen);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1751
    public synchronized void C_VerifyInit(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1752
            long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
        super.C_VerifyInit(hSession, pMechanism, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1756
    public synchronized void C_Verify(long hSession, byte[] pData,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1757
            byte[] pSignature) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
        super.C_Verify(hSession, pData, pSignature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1761
    public synchronized void C_VerifyUpdate(long hSession, long directIn,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1762
            byte[] in, int inOfs, int inLen) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
        super.C_VerifyUpdate(hSession, directIn, in, inOfs, inLen);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1766
    public synchronized void C_VerifyFinal(long hSession, byte[] pSignature)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1767
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
        super.C_VerifyFinal(hSession, pSignature);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1771
    public synchronized void C_VerifyRecoverInit(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1772
            CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
        super.C_VerifyRecoverInit(hSession, pMechanism, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1776
    public synchronized int C_VerifyRecover(long hSession, byte[] in, int inOfs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1777
            int inLen, byte[] out, int outOufs, int outLen)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1778
            throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1779
        return super.C_VerifyRecover(hSession, in, inOfs, inLen, out, outOufs,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1780
                outLen);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1783
    public synchronized long C_GenerateKey(long hSession,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1784
            CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1785
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
        return super.C_GenerateKey(hSession, pMechanism, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
    public synchronized long[] C_GenerateKeyPair(long hSession,
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1790
            CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pPublicKeyTemplate,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1791
            CK_ATTRIBUTE[] pPrivateKeyTemplate)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1792
            throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1793
        return super.C_GenerateKeyPair(hSession, pMechanism, pPublicKeyTemplate,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1794
                pPrivateKeyTemplate);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1797
    public synchronized byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1798
            long hWrappingKey, long hKey) throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
        return super.C_WrapKey(hSession, pMechanism, hWrappingKey, hKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1800
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1801
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1802
    public synchronized long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism,
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1803
            long hUnwrappingKey, byte[] pWrappedKey, CK_ATTRIBUTE[] pTemplate)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1804
            throws PKCS11Exception {
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1805
        return super.C_UnwrapKey(hSession, pMechanism, hUnwrappingKey,
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1806
                pWrappedKey, pTemplate);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
    public synchronized long C_DeriveKey(long hSession, CK_MECHANISM pMechanism,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
    long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
        return super.C_DeriveKey(hSession, pMechanism, hBaseKey, pTemplate);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1814
    public synchronized void C_SeedRandom(long hSession, byte[] pSeed)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1815
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
        super.C_SeedRandom(hSession, pSeed);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1818
11507
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1819
    public synchronized void C_GenerateRandom(long hSession, byte[] randomData)
bd978326a655 6414899: P11Digest should support cloning
valeriep
parents: 5506
diff changeset
  1820
            throws PKCS11Exception {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1821
        super.C_GenerateRandom(hSession, randomData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1822
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1823
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1824
}