|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef _NSSDR_H_ |
|
8 #define _NSSDR_H_ |
|
9 |
|
10 #include "nsISecretDecoderRing.h" |
|
11 |
|
12 /** |
|
13 * NS_SDR_CONTRACTID - contract id for SDR services. |
|
14 * Implements nsISecretDecoderRing. |
|
15 * Should eventually implement an interface to set window |
|
16 * context and other information. (nsISecretDecoderRingConfig) |
|
17 * |
|
18 * NOTE: This definition should move to base code. It |
|
19 * is conditionally defined here until it is moved. |
|
20 * Delete this after defining in the new location. |
|
21 */ |
|
22 #ifndef NS_SDR_CONTRACTID |
|
23 #define NS_SDR_CONTRACTID "@mozilla.org/security/sdr;1" |
|
24 #endif |
|
25 |
|
26 // =============================================== |
|
27 // nsSecretDecoderRing - implementation of nsISecretDecoderRing |
|
28 // =============================================== |
|
29 |
|
30 #define NS_SDR_CID \ |
|
31 { 0x0c4f1ddc, 0x1dd2, 0x11b2, { 0x9d, 0x95, 0xf2, 0xfd, 0xf1, 0x13, 0x04, 0x4b } } |
|
32 |
|
33 class nsSecretDecoderRing |
|
34 : public nsISecretDecoderRing, |
|
35 public nsISecretDecoderRingConfig |
|
36 { |
|
37 public: |
|
38 NS_DECL_ISUPPORTS |
|
39 NS_DECL_NSISECRETDECODERRING |
|
40 NS_DECL_NSISECRETDECODERRINGCONFIG |
|
41 |
|
42 nsSecretDecoderRing(); |
|
43 virtual ~nsSecretDecoderRing(); |
|
44 |
|
45 private: |
|
46 |
|
47 /** |
|
48 * encode - encodes binary into BASE64 string. |
|
49 * decode - decode BASE64 string into binary. |
|
50 */ |
|
51 nsresult encode(const unsigned char *data, int32_t dataLen, char **_retval); |
|
52 nsresult decode(const char *data, unsigned char **result, int32_t * _retval); |
|
53 |
|
54 }; |
|
55 |
|
56 #endif /* _NSSDR_H_ */ |