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