~ubuntu-branches/ubuntu/precise/kompozer/precise

« back to all changes in this revision

Viewing changes to mozilla/security/manager/ssl/src/nsNSSCertificate.h

  • Committer: Bazaar Package Importer
  • Author(s): Anthony Yarusso
  • Date: 2007-08-27 01:11:03 UTC
  • Revision ID: james.westby@ubuntu.com-20070827011103-2jgf4s6532gqu2ka
Tags: upstream-0.7.10
ImportĀ upstreamĀ versionĀ 0.7.10

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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/
 
6
 * 
 
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.
 
11
 * 
 
12
 * The Original Code is the Netscape security libraries.
 
13
 * 
 
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
 
17
 * Rights Reserved.
 
18
 * 
 
19
 * Contributor(s):
 
20
 *  Ian McGreer <mcgreer@netscape.com>
 
21
 *  Javier Delgadillo <javi@netscape.com>
 
22
 * 
 
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
 
33
 * GPL.
 
34
 *
 
35
 */
 
36
 
 
37
#ifndef _NS_NSSCERTIFICATE_H_
 
38
#define _NS_NSSCERTIFICATE_H_
 
39
 
 
40
#include "nsIX509Cert.h"
 
41
#include "nsIX509CertDB.h"
 
42
#include "nsIASN1Object.h"
 
43
#include "nsISMimeCert.h"
 
44
#include "nsNSSShutDown.h"
 
45
 
 
46
#include "nsNSSCertHeader.h"
 
47
 
 
48
class nsINSSComponent;
 
49
class nsIASN1Sequence;
 
50
 
 
51
/* Certificate */
 
52
class nsNSSCertificate : public nsIX509Cert,
 
53
                         public nsISMimeCert,
 
54
                         public nsNSSShutDownObject
 
55
{
 
56
public:
 
57
  NS_DECL_ISUPPORTS
 
58
  NS_DECL_NSIX509CERT
 
59
  NS_DECL_NSISMIMECERT
 
60
 
 
61
  nsNSSCertificate(CERTCertificate *cert);
 
62
  /* from a request? */
 
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);
 
70
 
 
71
  static char* defaultServerNickname(CERTCertificate* cert);
 
72
 
 
73
private:
 
74
  CERTCertificate *mCert;
 
75
  PRBool           mPermDelete;
 
76
  PRUint32         mCertType;
 
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();
 
84
};
 
85
 
 
86
#define NS_NSS_LONG 4
 
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); 
 
95
 
 
96
 
 
97
 
 
98
 
 
99
#endif /* _NS_NSSCERTIFICATE_H_ */