certdecode.c (1370B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef PKIT_H 6 #include "pkit.h" 7 #endif /* PKIT_H */ 8 9 #ifndef PKIM_H 10 #include "pkim.h" 11 #endif /* PKIM_H */ 12 13 /* This is defined in pki3hack.c */ 14 NSS_EXTERN nssDecodedCert * 15 nssDecodedPKIXCertificate_Create( 16 NSSArena *arenaOpt, 17 NSSDER *encoding); 18 19 NSS_IMPLEMENT PRStatus 20 nssDecodedPKIXCertificate_Destroy( 21 nssDecodedCert *dc); 22 23 NSS_IMPLEMENT nssDecodedCert * 24 nssDecodedCert_Create( 25 NSSArena *arenaOpt, 26 NSSDER *encoding, 27 NSSCertificateType type) 28 { 29 nssDecodedCert *rvDC = NULL; 30 switch (type) { 31 case NSSCertificateType_PKIX: 32 rvDC = nssDecodedPKIXCertificate_Create(arenaOpt, encoding); 33 break; 34 default: 35 #if 0 36 nss_SetError(NSS_ERROR_INVALID_ARGUMENT); 37 #endif 38 return (nssDecodedCert *)NULL; 39 } 40 return rvDC; 41 } 42 43 NSS_IMPLEMENT PRStatus 44 nssDecodedCert_Destroy( 45 nssDecodedCert *dc) 46 { 47 if (!dc) { 48 return PR_FAILURE; 49 } 50 switch (dc->type) { 51 case NSSCertificateType_PKIX: 52 return nssDecodedPKIXCertificate_Destroy(dc); 53 default: 54 #if 0 55 nss_SetError(NSS_ERROR_INVALID_ARGUMENT); 56 #endif 57 break; 58 } 59 return PR_FAILURE; 60 }