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