SelectTLSClientAuthCertParent.h (2283B)
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 SECURITY_MANAGER_SSL_SELECTTLSCLIENTAUTHCERTPARENT_H_ 8 #define SECURITY_MANAGER_SSL_SELECTTLSCLIENTAUTHCERTPARENT_H_ 9 10 #include "mozilla/OriginAttributes.h" 11 #include "mozilla/psm/PSelectTLSClientAuthCertParent.h" 12 13 namespace mozilla { 14 namespace psm { 15 16 // Parent process component of the SelectTLSClientAuthCert IPC protocol. When 17 // the socket process encounters a TLS server that requests a client 18 // authentication certificate, Dispatch will be called via IPC with the 19 // information associated with that connection. That function dispatches an 20 // event to the main thread that determines what certificate to select, if any 21 // (usually by opening a dialog for the user to interact with). When a 22 // certificate (or no certificate) has been selected, TLSClientAuthCertSelected 23 // will be called on the IPC thread, which will cause 24 // SelectTLSClientAuthCertChild::RecvTLSClientAuthCertSelected to be called via 25 // IPC, which will get the appropriate information to NSS to continue the 26 // connection. 27 class SelectTLSClientAuthCertParent : public PSelectTLSClientAuthCertParent { 28 public: 29 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(SelectTLSClientAuthCertParent, override) 30 31 SelectTLSClientAuthCertParent() = default; 32 33 bool Dispatch(const nsACString& aHostName, 34 const OriginAttributes& aOriginAttributes, const int32_t& aPort, 35 const uint32_t& aProviderFlags, 36 const uint32_t& aProviderTlsFlags, 37 const ByteArray& aServerCertBytes, 38 nsTArray<ByteArray>&& aCANames, 39 const uint64_t& aBrowsingContextID); 40 41 void TLSClientAuthCertSelected( 42 const nsTArray<uint8_t>& aSelectedCertBytes, 43 nsTArray<nsTArray<uint8_t>>&& aSelectedCertChainBytes); 44 45 private: 46 ~SelectTLSClientAuthCertParent() = default; 47 48 void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason aWhy) override; 49 }; 50 51 } // namespace psm 52 } // namespace mozilla 53 54 #endif // SECURITY_MANAGER_SSL_SELECTTLSCLIENTAUTHCERTPARENT_H_