gnunet-android

GNUnet for Android
Log | Files | Refs | README

pkcs12.h (2668B)


      1 /* pkcs12.h
      2  *
      3  * Copyright (C) 2006-2025 wolfSSL Inc.
      4  *
      5  * This file is part of wolfSSL.
      6  *
      7  * wolfSSL is free software; you can redistribute it and/or modify
      8  * it under the terms of the GNU General Public License as published by
      9  * the Free Software Foundation; either version 3 of the License, or
     10  * (at your option) any later version.
     11  *
     12  * wolfSSL is distributed in the hope that it will be useful,
     13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  * GNU General Public License for more details.
     16  *
     17  * You should have received a copy of the GNU General Public License
     18  * along with this program; if not, write to the Free Software
     19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
     20  */
     21 
     22 
     23 #ifndef WOLF_CRYPT_PKCS12_H
     24 #define WOLF_CRYPT_PKCS12_H
     25 
     26 #include <wolfssl/wolfcrypt/types.h>
     27 
     28 #ifdef __cplusplus
     29     extern "C" {
     30 #endif
     31 
     32 typedef struct WC_PKCS12 WC_PKCS12;
     33 
     34 typedef struct WC_DerCertList { /* dereferenced in ssl.c */
     35     byte* buffer;
     36     word32 bufferSz;
     37     struct WC_DerCertList* next;
     38 } WC_DerCertList;
     39 
     40 /* default values for creating PKCS12 */
     41 enum {
     42     WC_PKCS12_ITT_DEFAULT = 2048,
     43     WC_PKCS12_VERSION_DEFAULT = 3,
     44     WC_PKCS12_MAC_DEFAULT = 1
     45 };
     46 
     47 WOLFSSL_API WC_PKCS12* wc_PKCS12_new(void);
     48 WOLFSSL_API WC_PKCS12* wc_PKCS12_new_ex(void* heap);
     49 WOLFSSL_API void wc_PKCS12_free(WC_PKCS12* pkcs12);
     50 WOLFSSL_API int wc_d2i_PKCS12(const byte* der, word32 derSz, WC_PKCS12* pkcs12);
     51 #ifndef NO_FILESYSTEM
     52 WOLFSSL_API int wc_d2i_PKCS12_fp(const char* file, WC_PKCS12** pkcs12);
     53 #endif
     54 WOLFSSL_API int wc_i2d_PKCS12(WC_PKCS12* pkcs12, byte** der, int* derSz);
     55 WOLFSSL_API int wc_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw,
     56         byte** pkey, word32* pkeySz, byte** cert, word32* certSz,
     57         WC_DerCertList** ca);
     58 WOLFSSL_API int wc_PKCS12_parse_ex(WC_PKCS12* pkcs12, const char* psw,
     59         byte** pkey, word32* pkeySz, byte** cert, word32* certSz,
     60         WC_DerCertList** ca, int keepKeyHeader);
     61 WOLFSSL_LOCAL int wc_PKCS12_verify_ex(WC_PKCS12* pkcs12,
     62         const byte* psw, word32 pswSz);
     63 WOLFSSL_API WC_PKCS12* wc_PKCS12_create(char* pass, word32 passSz,
     64         char* name, byte* key, word32 keySz, byte* cert, word32 certSz,
     65         WC_DerCertList* ca, int nidKey, int nidCert, int iter, int macIter,
     66         int keyType, void* heap);
     67 
     68 
     69 WOLFSSL_LOCAL int wc_PKCS12_SetHeap(WC_PKCS12* pkcs12, void* heap);
     70 WOLFSSL_LOCAL void* wc_PKCS12_GetHeap(WC_PKCS12* pkcs12);
     71 
     72 WOLFSSL_API void wc_FreeCertList(WC_DerCertList* list, void* heap);
     73 
     74 #ifdef __cplusplus
     75     } /* extern "C" */
     76 #endif
     77 
     78 #endif /* WOLF_CRYPT_PKCS12_H */
     79