UDK 3.2.7 C/C++ API Reference
rtl/cipher.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 
00029 #ifndef _RTL_CIPHER_H_
00030 #define _RTL_CIPHER_H_
00031 
00032 #include <sal/types.h>
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00038 /*========================================================================
00039  *
00040  * rtlCipher interface.
00041  *
00042  *======================================================================*/
00045 typedef void* rtlCipher;
00046 
00047 
00051 enum __rtl_CipherAlgorithm
00052 {
00053     rtl_Cipher_AlgorithmBF,
00054     rtl_Cipher_AlgorithmARCFOUR,
00055     rtl_Cipher_AlgorithmInvalid,
00056     rtl_Cipher_Algorithm_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00057 };
00058 
00061 typedef enum __rtl_CipherAlgorithm rtlCipherAlgorithm;
00062 
00063 
00067 enum __rtl_CipherMode
00068 {
00069     rtl_Cipher_ModeECB,
00070     rtl_Cipher_ModeCBC,
00071     rtl_Cipher_ModeStream,
00072     rtl_Cipher_ModeInvalid,
00073     rtl_Cipher_Mode_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00074 };
00075 
00078 typedef enum __rtl_CipherMode rtlCipherMode;
00079 
00080 
00084 enum __rtl_CipherDirection
00085 {
00086     rtl_Cipher_DirectionBoth,
00087     rtl_Cipher_DirectionDecode,
00088     rtl_Cipher_DirectionEncode,
00089     rtl_Cipher_DirectionInvalid,
00090     rtl_Cipher_Direction_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00091 };
00092 
00095 typedef enum __rtl_CipherDirection rtlCipherDirection;
00096 
00097 
00100 enum __rtl_CipherError
00101 {
00102     rtl_Cipher_E_None,
00103     rtl_Cipher_E_Argument,
00104     rtl_Cipher_E_Algorithm,
00105     rtl_Cipher_E_Direction,
00106     rtl_Cipher_E_Mode,
00107     rtl_Cipher_E_BufferSize,
00108     rtl_Cipher_E_Memory,
00109     rtl_Cipher_E_Unknown,
00110     rtl_Cipher_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
00111 };
00112 
00115 typedef enum __rtl_CipherError rtlCipherError;
00116 
00117 
00126 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_create (
00127     rtlCipherAlgorithm Algorithm,
00128     rtlCipherMode      Mode
00129 ) SAL_THROW_EXTERN_C();
00130 
00131 
00143 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_init (
00144     rtlCipher           Cipher,
00145     rtlCipherDirection  Direction,
00146     const sal_uInt8    *pKeyData, sal_Size nKeyLen,
00147     const sal_uInt8    *pArgData, sal_Size nArgLen
00148 ) SAL_THROW_EXTERN_C();
00149 
00150 
00162 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encode (
00163     rtlCipher   Cipher,
00164     const void *pData,   sal_Size nDatLen,
00165     sal_uInt8  *pBuffer, sal_Size nBufLen
00166 ) SAL_THROW_EXTERN_C();
00167 
00168 
00180 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decode (
00181     rtlCipher   Cipher,
00182     const void *pData,   sal_Size nDatLen,
00183     sal_uInt8  *pBuffer, sal_Size nBufLen
00184 ) SAL_THROW_EXTERN_C();
00185 
00186 
00191 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroy (
00192     rtlCipher Cipher
00193 ) SAL_THROW_EXTERN_C();
00194 
00195 
00196 /*========================================================================
00197  *
00198  * rtl_cipherBF (Blowfish) interface.
00199  *
00200  *======================================================================*/
00207 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createBF (
00208     rtlCipherMode Mode
00209 ) SAL_THROW_EXTERN_C();
00210 
00211 
00215 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initBF (
00216     rtlCipher          Cipher,
00217     rtlCipherDirection Direction,
00218     const sal_uInt8 *pKeyData, sal_Size nKeyLen,
00219     const sal_uInt8 *pArgData, sal_Size nArgLen
00220 ) SAL_THROW_EXTERN_C();
00221 
00222 
00226 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeBF (
00227     rtlCipher   Cipher,
00228     const void *pData,   sal_Size nDatLen,
00229     sal_uInt8  *pBuffer, sal_Size nBufLen
00230 ) SAL_THROW_EXTERN_C();
00231 
00232 
00236 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeBF (
00237     rtlCipher   Cipher,
00238     const void *pData,   sal_Size nDatLen,
00239     sal_uInt8  *pBuffer, sal_Size nBufLen
00240 ) SAL_THROW_EXTERN_C();
00241 
00242 
00246 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyBF (
00247     rtlCipher Cipher
00248 ) SAL_THROW_EXTERN_C();
00249 
00250 
00251 /*========================================================================
00252  *
00253  * rtl_cipherARCFOUR (RC4) interface.
00254  *
00255  *======================================================================*/
00265 SAL_DLLPUBLIC rtlCipher SAL_CALL rtl_cipher_createARCFOUR (
00266     rtlCipherMode Mode
00267 ) SAL_THROW_EXTERN_C();
00268 
00269 
00273 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_initARCFOUR (
00274     rtlCipher          Cipher,
00275     rtlCipherDirection Direction,
00276     const sal_uInt8 *pKeyData, sal_Size nKeyLen,
00277     const sal_uInt8 *pArgData, sal_Size nArgLen
00278 ) SAL_THROW_EXTERN_C();
00279 
00280 
00284 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_encodeARCFOUR (
00285     rtlCipher   Cipher,
00286     const void *pData,   sal_Size nDatLen,
00287     sal_uInt8  *pBuffer, sal_Size nBufLen
00288 ) SAL_THROW_EXTERN_C();
00289 
00290 
00294 SAL_DLLPUBLIC rtlCipherError SAL_CALL rtl_cipher_decodeARCFOUR (
00295     rtlCipher   Cipher,
00296     const void *pData,   sal_Size nDatLen,
00297     sal_uInt8  *pBuffer, sal_Size nBufLen
00298 ) SAL_THROW_EXTERN_C();
00299 
00300 
00304 SAL_DLLPUBLIC void SAL_CALL rtl_cipher_destroyARCFOUR (
00305     rtlCipher Cipher
00306 ) SAL_THROW_EXTERN_C();
00307 
00308 
00309 /*========================================================================
00310  *
00311  * The End.
00312  *
00313  *======================================================================*/
00314 
00315 #ifdef __cplusplus
00316 }
00317 #endif
00318 
00319 #endif /* !_RTL_CIPHER_H_ */
00320 
00321 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines