2
* The contents of this file are subject to the Mozilla Public
3
* License Version 1.1 (the "License"); you may not use this file
4
* except in compliance with the License. You may obtain a copy of
5
* the License at http://www.mozilla.org/MPL/
7
* Software distributed under the License is distributed on an "AS
8
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9
* implied. See the License for the specific language governing
10
* rights and limitations under the License.
12
* The Original Code is the Netscape security libraries.
14
* The Initial Developer of the Original Code is Netscape
15
* Communications Corporation. Portions created by Netscape are
16
* Copyright (C) 2000 Netscape Communications Corporation. All
20
* Ian McGreer <mcgreer@netscape.com>
21
* Javier Delgadillo <javi@netscape.com>
23
* Alternatively, the contents of this file may be used under the
24
* terms of the GNU General Public License Version 2 or later (the
25
* "GPL"), in which case the provisions of the GPL are applicable
26
* instead of those above. If you wish to allow use of your
27
* version of this file only under the terms of the GPL and not to
28
* allow others to use your version of this file under the MPL,
29
* indicate your decision by deleting the provisions above and
30
* replace them with the notice and other provisions required by
31
* the GPL. If you do not delete the provisions above, a recipient
32
* may use your version of this file under either the MPL or the
37
#ifndef _NS_NSSCERTIFICATE_H_
38
#define _NS_NSSCERTIFICATE_H_
40
#include "nsIX509Cert.h"
41
#include "nsIX509CertDB.h"
42
#include "nsIASN1Object.h"
43
#include "nsISMimeCert.h"
44
#include "nsNSSShutDown.h"
46
#include "nsNSSCertHeader.h"
48
class nsINSSComponent;
49
class nsIASN1Sequence;
52
class nsNSSCertificate : public nsIX509Cert,
54
public nsNSSShutDownObject
61
nsNSSCertificate(CERTCertificate *cert);
63
virtual ~nsNSSCertificate();
64
CERTCertificate *GetCert();
65
nsresult MarkForPermDeletion();
66
nsresult SetCertType(PRUint32 aCertType);
67
nsresult GetCertType(PRUint32 *aCertType);
68
nsresult FormatUIStrings(const nsAutoString &nickname, nsAutoString &nickWithSerial, nsAutoString &details);
69
static nsNSSCertificate* ConstructFromDER(char *certDER, int derLen);
71
static char* defaultServerNickname(CERTCertificate* cert);
74
CERTCertificate *mCert;
77
nsCOMPtr<nsIASN1Object> mASN1Structure;
78
nsresult CreateASN1Struct();
79
nsresult CreateTBSCertificateASN1Struct(nsIASN1Sequence **retSequence,
80
nsINSSComponent *nssComponent);
81
nsresult GetSortableDate(PRTime aTime, nsAString &_aSortableDate);
82
virtual void virtualDestroyNSSReference();
83
void destructorSafeDestroyNSSReference();
87
#define NS_NSS_GET_LONG(x) ((((unsigned long)((x)[0])) << 24) | \
88
(((unsigned long)((x)[1])) << 16) | \
89
(((unsigned long)((x)[2])) << 8) | \
90
((unsigned long)((x)[3])) )
91
#define NS_NSS_PUT_LONG(src,dest) (dest)[0] = (((src) >> 24) & 0xff); \
92
(dest)[1] = (((src) >> 16) & 0xff); \
93
(dest)[2] = (((src) >> 8) & 0xff); \
94
(dest)[3] = ((src) & 0xff);
99
#endif /* _NS_NSSCERTIFICATE_H_ */