00001 00009 /****************************************************************************** 00010 * 00011 * File: keystore_client.c 00012 * 00013 * Function: Secure Storage Keystore client API Library header file 00014 * 00015 * Author(s): Giordano Scuderi and Nicola Dominante 00016 * 00017 * Copyright: Copyright (c) 2007 <Giordano Scuderi - gscuderi@unicosrl.it> 00018 * All Rights Reserved. 00019 * 00020 * 00021 * Notes: Redistributions of any form whatsoever must retain the following 00022 * acknowledgment: 00023 * "This product includes software developed by Giordano Scuderi 00024 * and Nicola Dominante for Unico SRL" 00025 * 00026 * ==================================================================== 00027 * Copyright (c) Giordano Scuderi, Unico SRL. All rights reserved. 00028 * 00029 * Redistribution and use in source and binary forms, with or without 00030 * modification, are permitted provided that the following conditions 00031 * are met: 00032 * 00033 * 1. Redistributions of source code must retain the above copyright 00034 * notice, this list of conditions and the following disclaimer. 00035 * 00036 * 2. Redistributions in binary form must reproduce the above copyright 00037 * notice, this list of conditions and the following disclaimer in 00038 * the documentation and/or other materials provided with the 00039 * distribution. 00040 * 00041 * 3. All advertising materials mentioning features or use of this 00042 * software must display the following acknowledgment: 00043 * "This product includes software developed by Giordano Scuderi 00044 * for Unico SRL" 00045 * 00046 * 4. The names "Secure Storage" must not be used to 00047 * endorse or promote products derived from this software without 00048 * prior written permission. For written permission, please contact 00049 * gscuderi@unicosrl.it. 00050 * 00051 * 5. Products derived from this software may not be called "Secure Storage" 00052 * nor may "Secure Storage" appear in their names without prior written 00053 * permission of Giordano Scuderi (Unico SRL). 00054 * 00055 * 6. Redistributions of any form whatsoever must retain the following 00056 * acknowledgment: 00057 * "This product includes software developed by Giordano Scuderi 00058 * for Unico SRL" 00059 * 00060 * THIS SOFTWARE IS PROVIDED BY UNICO SRL ``AS IS'' AND ANY 00061 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00062 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00063 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UNICO SRL OR 00064 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00065 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00066 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00067 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00068 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 00069 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00070 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 00071 * OF THE POSSIBILITY OF SUCH DAMAGE. 00072 * ==================================================================== 00073 * 00074 * "This product includes software developed by the OpenSSL Project 00075 * for use in the OpenSSL Toolkit (http://www.openssl.org/)" 00076 * 00077 */ 00078 00080 #include <sys/socket.h> 00081 #include <globus_gss_assist.h> 00082 00083 typedef int param_len; 00084 00085 00086 #ifdef __cplusplus 00087 extern "C" 00088 #endif 00089 00102 int ss_send_key ( const char *lfn, const unsigned char *key, const unsigned char *iv ); 00103 00116 int ss_get_key ( const char *lfn, unsigned char *key, unsigned char *iv ); 00117 00128 int ss_delete_key ( const char *lfn ); 00129 00130 #ifdef __cplusplus 00131 } /* closing brace for extern "C" */ 00132 #endif 00133 00134 #define KEYSTORE_HOST "SS_GRID_KEYSTORE_HOST" 00135 #define KEYSTORE_DN "SS_GRID_KEYSTORE_DN" 00136 #define SEND 0 00137 #define GET 1 00138 #define DEL 2 00139 00140 #define SSKEYSTORE_EPARAM 10001 /* Keystore: Wrong parameters number */ 00141 #define SSKEYSTORE_ESAVE 10002 /* Keystore: Error in saving data */ 00142 #define SSKEYSTORE_EPERM 10003 /* Keystore: User not authorized */ 00143 #define SSKEYSTORE_ERROR 10004 /* Keystore: Generic Error */ 00144 #define SSKEYSTORE_EREAD 10005 /* Keystore: Error reading key or iv */ 00145 #define SSKEYSTORE_EDELETE 10006 /* Keystore: Cannot delete the key */ 00146 #define SSKEYSTORE_ENOENT 10007 /* Keystore: A key for this LFN doesn't exist */ 00147 #define SSKEYSTORE_EEXIST 10008 /* Keystore: A Key for this LFN just exists */ 00148 #define SS_EINVALLFN 10009 /* Invalid LFN specified */ 00149 #define SS_EINVALVO 10010 /* Invalid VO specified */ 00150 #define SS_EINVALGUID 10011 /* Invalid GUID specified */ 00151 #define SS_EINVALSE 10012 /* Invalid SE specified */ 00152 #define SS_EINVALSOURCE 10013 /* Invalid source file specified */ 00153 #define SS_EINVALDEST 10014 /* Invalid destination file specified */ 00154 #define SS_EINVAL 10015 /* Invalid parameter specified */ 00155 #define SS_EEXIST 10016 /* File Exist */ 00156 #define SS_ENOENT 10017 /* No such file or directory */ 00157 #define SS_ENOREPLICA 10018 /* No replica found */ 00158 #define SS_EACCES 10019 /* Permission Denied */ 00159 #define SS_ESPIPE 10020 /* Illegal seek */ 00160 #define SS_EOFFSET 10021 /* Invalid offset specified */ 00161 #define SS_EWHENCE 10022 /* Invalid whence specified */ 00162 #define SS_ESOURCENAMETOOLONG 10023 /* Source file name too long */ 00163 #define SS_EDESTNAMETOOLONG 10024 /* Destination file name too long */ 00164 #define SS_ENAMETOOLONG 10025 /* File name too long */ 00165 #define SS_ENOGRIDSSKEYSTOREENV 10026 /* Invalid SS_GRID_KEYSTORE_HOST Environment Variable */ 00166 #define SS_ENOGRIDSSKEYSTOREDNENV 10027 /* Invalid SS_GRID_KEYSTORE_DN Environment Variable */ 00167 #define SS_ENOLOCALSSKEYSTOREENV 10028 /* Invalid SS_LOCAL_KEYSTORE_HOST Environment Variable */ 00168 #define SS_ENOLOCALSSKEYSTOREDNENV 10029 /* Invalid SS_LOCAL_KEYSTORE_DN Environment Variable */ 00169 #define SS_EKEYSTOREAUTH 10030 /* Authentication with Keystore failed */ 00170 #define SS_EKEYSTORECONNFAILED 10031 /* Connection to the Keystore failed */ 00171 #define SS_EKEYSTORESEND 10032 /* Send data to keystore failed */ 00172 #define SS_EKEYSTORERCV 10033 /* Receive data to keystore failed */ 00173 #define SS_EKEYSTORECLOSE 10034 /* Error when closing connection to the keystore */ 00174 #define SS_EENCINIT 10035 /* AES encryption initializing failed */ 00175 #define SSKEYSTORE_HOSTNOTFOUND 10036 /* Keystore: The specified host is unknown. */ 00176 #define SSKEYSTORE_NODATAORADDR 10037 /* Keystore: The requested name is valid but does not have an IP address. */ 00177 #define SSKEYSTORE_NORECOVERY 10038 /* Keystore: A non-recoverable name server error occurred. */ 00178 #define SSKEYSTORE_TRY_AGAIN 10039 /* Keystore: A temporary error occurred on an authoritative name server.Try again later. */ 00179 #define SSKEYSTORE_NOCREDFOUND 10040 /* Keystore: No credentials found. */ 00180 #define SSKEYSTORE_NOSECURECONTEXT 10041 /* Keystore: No context has been established. */ 00181 #define SSKEYSTORE_FAILEDINQUIRECONTEXT 10042 /* Keystore: The referenced context could not be accessed. */ 00182 #define SSKEYSTORE_FAILEDDELETECONTEXT 10043 /* Keystore: The referenced context could not be deleted. */ 00183 #define SSKEYSTORE_CONTEXTEXPIRED 10044 /* Keystore: The context has already expired. */ 00184 #define SSKEYSTORE_BADQOP 10045 /* Keystore: The specified QOP is not supported by the mechanism. */ 00185 #define SSKEYSTORE_FAILEDWRAPMSG 10046 /* Keystore: Generic error on wrapping message. */ 00186 #define SSKEYSTORE_INVALIDTOKEN 10047 /* Keystore: Invalid token argument. */ 00187 #define SSKEYSTORE_TOKENEOF 10048 /* Keystore: No token has been read. */ 00188 #define SSKEYSTORE_TOKENTOOLARGE 10049 /* Keystore: Token too large. */ 00189 #define SSKEYSTORE_DEFECTIVETOKEN 10050 /* Keystore: The token failed consistency checks. */ 00190 #define SSKEYSTORE_BADSIG 10051 /* Keystore: The MIC was incorrect. */ 00191 #define SSKEYSTORE_DUPLICATETOKEN 10052 /* Keystore: The token is too old to check for duplication. */ 00192 #define SSKEYSTORE_UNSEQTOKEN 10053 /* Keystore: The token has been verified out of sequence; a later token has already been received. */ 00193 #define SSKEYSTORE_GAPTOKEN 10054 /* Keystore: The token has been verified out of sequence; an earlier expected token has not yet been received. */ 00194 #define SSKEYSTORE_FAILEDUNWRAPMSG 10055 /* Keystore: Generic error on unwrapping message. */