OLD | NEW |
| (Empty) |
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 #ifdef DEBUG | |
6 static const char CVS_ID[] = "@(#) $RCSfile: certdecode.c,v $ $Revision: 1.18 $
$Date: 2012/04/25 14:50:07 $"; | |
7 #endif /* DEBUG */ | |
8 | |
9 #ifndef PKIT_H | |
10 #include "pkit.h" | |
11 #endif /* PKIT_H */ | |
12 | |
13 #ifndef PKIM_H | |
14 #include "pkim.h" | |
15 #endif /* PKIM_H */ | |
16 | |
17 /* This is defined in pki3hack.c */ | |
18 NSS_EXTERN nssDecodedCert * | |
19 nssDecodedPKIXCertificate_Create ( | |
20 NSSArena *arenaOpt, | |
21 NSSDER *encoding | |
22 ); | |
23 | |
24 NSS_IMPLEMENT PRStatus | |
25 nssDecodedPKIXCertificate_Destroy ( | |
26 nssDecodedCert *dc | |
27 ); | |
28 | |
29 NSS_IMPLEMENT nssDecodedCert * | |
30 nssDecodedCert_Create ( | |
31 NSSArena *arenaOpt, | |
32 NSSDER *encoding, | |
33 NSSCertificateType type | |
34 ) | |
35 { | |
36 nssDecodedCert *rvDC = NULL; | |
37 switch(type) { | |
38 case NSSCertificateType_PKIX: | |
39 rvDC = nssDecodedPKIXCertificate_Create(arenaOpt, encoding); | |
40 break; | |
41 default: | |
42 #if 0 | |
43 nss_SetError(NSS_ERROR_INVALID_ARGUMENT); | |
44 #endif | |
45 return (nssDecodedCert *)NULL; | |
46 } | |
47 return rvDC; | |
48 } | |
49 | |
50 NSS_IMPLEMENT PRStatus | |
51 nssDecodedCert_Destroy ( | |
52 nssDecodedCert *dc | |
53 ) | |
54 { | |
55 if (!dc) { | |
56 return PR_FAILURE; | |
57 } | |
58 switch(dc->type) { | |
59 case NSSCertificateType_PKIX: | |
60 return nssDecodedPKIXCertificate_Destroy(dc); | |
61 default: | |
62 #if 0 | |
63 nss_SetError(NSS_ERROR_INVALID_ARGUMENT); | |
64 #endif | |
65 break; | |
66 } | |
67 return PR_FAILURE; | |
68 } | |
69 | |
OLD | NEW |