1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/src/nsSDR.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef _NSSDR_H_ 1.11 +#define _NSSDR_H_ 1.12 + 1.13 +#include "nsISecretDecoderRing.h" 1.14 + 1.15 +/** 1.16 + * NS_SDR_CONTRACTID - contract id for SDR services. 1.17 + * Implements nsISecretDecoderRing. 1.18 + * Should eventually implement an interface to set window 1.19 + * context and other information. (nsISecretDecoderRingConfig) 1.20 + * 1.21 + * NOTE: This definition should move to base code. It 1.22 + * is conditionally defined here until it is moved. 1.23 + * Delete this after defining in the new location. 1.24 + */ 1.25 +#ifndef NS_SDR_CONTRACTID 1.26 +#define NS_SDR_CONTRACTID "@mozilla.org/security/sdr;1" 1.27 +#endif 1.28 + 1.29 +// =============================================== 1.30 +// nsSecretDecoderRing - implementation of nsISecretDecoderRing 1.31 +// =============================================== 1.32 + 1.33 +#define NS_SDR_CID \ 1.34 + { 0x0c4f1ddc, 0x1dd2, 0x11b2, { 0x9d, 0x95, 0xf2, 0xfd, 0xf1, 0x13, 0x04, 0x4b } } 1.35 + 1.36 +class nsSecretDecoderRing 1.37 +: public nsISecretDecoderRing, 1.38 + public nsISecretDecoderRingConfig 1.39 +{ 1.40 +public: 1.41 + NS_DECL_ISUPPORTS 1.42 + NS_DECL_NSISECRETDECODERRING 1.43 + NS_DECL_NSISECRETDECODERRINGCONFIG 1.44 + 1.45 + nsSecretDecoderRing(); 1.46 + virtual ~nsSecretDecoderRing(); 1.47 + 1.48 +private: 1.49 + 1.50 + /** 1.51 + * encode - encodes binary into BASE64 string. 1.52 + * decode - decode BASE64 string into binary. 1.53 + */ 1.54 + nsresult encode(const unsigned char *data, int32_t dataLen, char **_retval); 1.55 + nsresult decode(const char *data, unsigned char **result, int32_t * _retval); 1.56 + 1.57 +}; 1.58 + 1.59 +#endif /* _NSSDR_H_ */