1 '\" te 2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved. 3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. 4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. 5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] 6 .TH SUNW_C_GETMECHSESSION 3EXT "April 9, 2016" 7 .SH NAME 8 SUNW_C_GetMechSession, SUNW_C_KeyToObject \- PKCS#11 Cryptographic Framework 9 functions 10 .SH SYNOPSIS 11 .LP 12 .nf 13 cc [ \fIflag \&.\|.\|.\fR ] \fIfile\fR\&.\|.\|. \fB-lpkcs11\fR [ \fIlibrary\&.\|.\|.\fR ] 14 #include <security/cryptoki.h> 15 #include <security/pkcs11.h> 16 17 \fBCK_RV\fR \fBSUNW_C_GetMechSession\fR(\fBCK_MECHANISM_TYPE\fR \fImech\fR, 18 \fBCK_SESSION_HANDLE_PTR\fR \fIhSession\fR); 19 .fi 20 21 .LP 22 .nf 23 \fBCK_RV\fR \fBSUNW_C_KeyToObject\fR(\fBCK_SESSION_HANDLE\fR \fIhSession\fR, 24 \fBCK_MECHANISM_TYPE\fR \fImech\fR, \fBconst void *\fR\fIrawkey\fR, \fBsize_t\fR \fIrawkey_len\fR, 25 \fBCK_OBJECT_HANDLE_PTR\fR \fIobj\fR); 26 .fi 27 28 .SH DESCRIPTION 29 .LP 30 These functions implement the RSA PKCS#11 v2.20 specification by using plug-ins 31 to provide the slots. 32 .sp 33 .LP 34 The \fBSUNW_C_GetMechSession()\fR function initializes the PKCS#11 35 cryptographic framework and performs all necessary calls to Standard PKCS#11 36 functions (see \fBlibpkcs11\fR(3LIB)) to create a session capable of providing 37 operations on the requested mechanism. It is not necessary to call 38 \fBC_Initalize()\fR or \fBC_GetSlotList()\fR before the first call to 39 \fBSUNW_C_GetMechSession()\fR. 40 .sp 41 .LP 42 If the \fBSUNW_C_GetMechSession()\fR function is called multiple times, it will 43 return a new session each time without re-initalizing the framework. If it is 44 unable to return a new session, \fBCKR_SESSION_COUNT\fR is returned. 45 .sp 46 .LP 47 The \fBC_CloseSession()\fR function should be called to release the session 48 when it is no longer required. 49 .sp 50 .LP 51 The \fBSUNW_C_KeyToObject()\fR function creates a key object for the specified 52 mechanism from the \fIrawkey\fR data. The object should be destroyed with 53 \fBC_DestroyObject()\fR when it is no longer required. 54 .SH RETURN VALUES 55 .LP 56 The \fBSUNW_C_GetMechSession()\fR function returns the following values: 57 .sp 58 .ne 2 59 .na 60 \fB\fBCKR_OK\fR\fR 61 .ad 62 .RS 25n 63 The function completed successfully. 64 .RE 65 66 .sp 67 .ne 2 68 .na 69 \fB\fBCKR_SESSION_COUNT\fR\fR 70 .ad 71 .RS 25n 72 No sessions are available. 73 .RE 74 75 .sp 76 .ne 2 77 .na 78 \fB\fBCKR_ARGUMENTS_BAD\fR\fR 79 .ad 80 .RS 25n 81 A null pointer was passed for the return session handle. 82 .RE 83 84 .sp 85 .ne 2 86 .na 87 \fB\fBCKR_MECHANISM_INVALID\fR\fR 88 .ad 89 .RS 25n 90 The requested mechanism is invalid or no available plug-in provider supports 91 it. 92 .RE 93 94 .sp 95 .ne 2 96 .na 97 \fB\fBCKR_FUNCTION_FAILED\fR\fR 98 .ad 99 .RS 25n 100 The function failed. 101 .RE 102 103 .sp 104 .ne 2 105 .na 106 \fB\fBCKR_GENERAL_ERROR\fR\fR 107 .ad 108 .RS 25n 109 A general error occurred. 110 .RE 111 112 .sp 113 .LP 114 The \fBSUNW_C_KeyToObject()\fR function returns the following values: 115 .sp 116 .ne 2 117 .na 118 \fB\fBCKR_OK\fR\fR 119 .ad 120 .RS 25n 121 The function completed successfully. 122 .RE 123 124 .sp 125 .ne 2 126 .na 127 \fB\fBCKR_ARGUMENTS_BAD\fR\fR 128 .ad 129 .RS 25n 130 A null pointer was passed for the session handle or the key material. 131 .RE 132 133 .sp 134 .ne 2 135 .na 136 \fB\fBCKR_MECHANISM_INVALID\fR\fR 137 .ad 138 .RS 25n 139 The requested mechanism is invalid or no available plug-in provider supports 140 it. 141 .RE 142 143 .sp 144 .ne 2 145 .na 146 \fB\fBCKR_FUNCTION_FAILED\fR\fR 147 .ad 148 .RS 25n 149 The function failed. 150 .RE 151 152 .sp 153 .ne 2 154 .na 155 \fB\fBCKR_GENERAL_ERROR\fR\fR 156 .ad 157 .RS 25n 158 A general error occurred. 159 .RE 160 161 .sp 162 .LP 163 The return values of each of the implemented functions are defined and listed 164 in the RSA PKCS#11 v2.20 specification. See http://www.rsasecurity.com. 165 .SH USAGE 166 .LP 167 These functions are not part of the RSA PKCS#11 v2.20 specification. They are 168 not likely to exist on non-Solaris systems. They are provided as a convenience 169 to application programmers. Use of these functions will make the application 170 non-portable to other systems. 171 .SH ATTRIBUTES 172 .LP 173 See \fBattributes\fR(5) for descriptions of the following attributes: 174 .sp 175 176 .sp 177 .TS 178 box; 179 c | c 180 l | l . 181 ATTRIBUTE TYPE ATTRIBUTE VALUE 182 _ 183 Interface Stability Evolving 184 _ 185 MT-Level MT-Safe 186 .TE 187 188 .SH SEE ALSO 189 .LP 190 \fBlibpkcs11\fR(3LIB), \fBattributes\fR(5) 191 .sp 192 .LP 193 http://www.rsasecurity.com