|
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 |
|
20 NSS_IMPLEMENT PRStatus |
|
21 nssDecodedPKIXCertificate_Destroy ( |
|
22 nssDecodedCert *dc |
|
23 ); |
|
24 |
|
25 NSS_IMPLEMENT nssDecodedCert * |
|
26 nssDecodedCert_Create ( |
|
27 NSSArena *arenaOpt, |
|
28 NSSDER *encoding, |
|
29 NSSCertificateType type |
|
30 ) |
|
31 { |
|
32 nssDecodedCert *rvDC = NULL; |
|
33 switch(type) { |
|
34 case NSSCertificateType_PKIX: |
|
35 rvDC = nssDecodedPKIXCertificate_Create(arenaOpt, encoding); |
|
36 break; |
|
37 default: |
|
38 #if 0 |
|
39 nss_SetError(NSS_ERROR_INVALID_ARGUMENT); |
|
40 #endif |
|
41 return (nssDecodedCert *)NULL; |
|
42 } |
|
43 return rvDC; |
|
44 } |
|
45 |
|
46 NSS_IMPLEMENT PRStatus |
|
47 nssDecodedCert_Destroy ( |
|
48 nssDecodedCert *dc |
|
49 ) |
|
50 { |
|
51 if (!dc) { |
|
52 return PR_FAILURE; |
|
53 } |
|
54 switch(dc->type) { |
|
55 case NSSCertificateType_PKIX: |
|
56 return nssDecodedPKIXCertificate_Destroy(dc); |
|
57 default: |
|
58 #if 0 |
|
59 nss_SetError(NSS_ERROR_INVALID_ARGUMENT); |
|
60 #endif |
|
61 break; |
|
62 } |
|
63 return PR_FAILURE; |
|
64 } |
|
65 |