1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: http_ClientCert.h 4 5 Copyright (C)2010 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 26779 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_HTTP_HTTP_CLIENTCERT_H_ 17 #define NN_HTTP_HTTP_CLIENTCERT_H_ 18 19 #include <nn/util/util_NonCopyable.h> 20 #include <nn/http/http_Types.h> 21 22 #ifdef __cplusplus 23 24 namespace nn { 25 namespace http { 26 27 class Connection; 28 29 /*! 30 @brief HTTPS用のクライアント証明書を表すクラスです。複数のHTTPS通信でクライアント証明書を使いまわしたい場合に利用します。 31 32 */ 33 class ClientCert : private nn::util::NonCopyable<ClientCert> 34 { 35 friend class Connection; 36 public: 37 /*! 38 @brief コンストラクタです。 39 */ 40 explicit ClientCert(); 41 42 /*! 43 @brief デストラクタです。 44 */ 45 virtual ~ClientCert (void); 46 47 /*! 48 @brief 証明書と秘密鍵の登録を行い、クライアント証明書を初期化します。 49 @param[in] pCertData 証明書データ。データフォーマットは、X.509 v3の証明書データ(ASN.1定義)をDERエンコードしたバイナリデータ。 50 @param[in] certDataSize pCertDataのサイズ 。 51 @param[in] pPrivateKeyData 秘密鍵のデータ。データフォーマットは、X.509の鍵データ(ASN.1定義)をDERエンコードしたバイナリデータ。 52 @param[in] privateKeyDataSize pPrivateKeyDataのサイズ 。 53 @return 処理の結果が返ります。<BR> 54 */ 55 nn::Result Initialize(const u8* pCertData, size_t certDataSize, const u8* pPrivateKeyData, size_t privateKeyDataSize); 56 57 /*! 58 @brief 機器内蔵クライアント証明書を登録して、クライアント証明書を初期化します。 59 @param[in] inClientCertName 対象の機器内蔵クライアント証明書(sslの @ref nn::ssl::InternalClientCertの値。) 60 @return 処理の結果が返ります。<BR> 61 */ 62 nn::Result Initialize(InternalClientCertId inClientCertName ); 63 64 65 /*! 66 @brief クライアント証明書の終了処理を行います。クライアント証明書の利用が全て終了したら、一度実施する必要があります。 67 @return 処理の結果が返ります。<BR> 68 */ 69 nn::Result Finalize(void); 70 71 private: 72 bool m_isInitialized; 73 NN_PADDING3; 74 CertId m_certId; 75 76 /*! 77 @brief クライアント証明書が有効なものか否かを取得します。 78 @return 処理の結果が返ります。<BR> 79 */ IsValid()80 bool IsValid(){return m_isInitialized;} 81 }; 82 83 } // end of namespace http 84 } // end of namespace nn 85 86 #endif // __cplusplus 87 88 89 #include <nn/util/detail/util_CLibImpl.h> 90 91 92 /*! 93 @addtogroup nn_http http 94 @{ 95 96 @defgroup nn_http_ClientCert_c ClientCert (C) 97 98 @brief @ref nn::http::ClientCert の C インタフェースモジュールです。 99 100 @{ 101 */ 102 103 /*! 104 @struct nnhttpClientCert 105 @brief HTTPのClientCertを表す C の構造体です。 106 107 @brief 対応するクラス @ref nn::http::ClientCert を参照してください。 108 */ 109 NN_UTIL_DETAIL_CLIBIMPL_DEFINE_BUFFER_CLASS(nnhttpClientCert, nn::http::ClientCert, 12, u32); 110 111 /*! 112 @brief 対応する C++ 関数 @ref nn::http::ClientCert::Initialize を参照してください。 113 */ 114 NN_EXTERN_C nnResult nnhttpClientCertInitialize(nnhttpClientCert* this_, const u8* pCertData, size_t certDataSize, const u8* pPrivateKeyData, size_t privateKeyDataSize); 115 116 /*! 117 @brief 対応する C++ 関数 @ref nn::http::ClientCert::Initialize を参照してください。 118 */ 119 NN_EXTERN_C nnResult nnhttpClientCertInitializeByInternalCert(nnhttpClientCert* this_, NnHttpInternalClientCertId inClientCertName); 120 121 122 /*! 123 @brief 対応する C++ 関数 @ref nn::http::ClientCert::Finalize を参照してください。 124 */ 125 NN_EXTERN_C nnResult nnhttpClientCertFinalize(nnhttpClientCert* this_); 126 127 128 /*! 129 @} 130 131 @} 132 */ 133 134 #endif /* NN_HTTP_HTTP_CLIENTCERT_H_ */ 135 136