This CL turns nativeConfiguration into createNativeConfiguration returning a pointer or nil on failure. This method's certificate generation is updated to use the new API and reports failure (nil) if unsuccessful instead of relying on the default certificate. We also remove the implicit assumption (now incorrect) that RSA is the default. This is the same type of changes as was done in https://codereview.webrtc.org/1965313002 but this file (RTCPeerConnectionInterface.mm) was forgotten. With no more usages of kIdentityName it and dtlsidentitystore.cc is removed. Also removes unnecessary #include in peerconnectioninterface.h that was still remnant due to an indirect include of kIdentityName. RTCConfiguration+Private.h now lists method nativeEncryptionKeyTypeForKeyType which was added in the above mentioned prior CL. BUG=webrtc:5707, webrtc:5708 Review-Url: https://codereview.webrtc.org/2035473004 Cr-Commit-Position: refs/heads/master@{#13089}
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
/*
|
|
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef WEBRTC_API_DTLSIDENTITYSTORE_H_
|
|
#define WEBRTC_API_DTLSIDENTITYSTORE_H_
|
|
|
|
#include <memory>
|
|
#include <queue>
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
#include "webrtc/base/messagehandler.h"
|
|
#include "webrtc/base/messagequeue.h"
|
|
#include "webrtc/base/optional.h"
|
|
#include "webrtc/base/refcount.h"
|
|
#include "webrtc/base/rtccertificategenerator.h"
|
|
#include "webrtc/base/scoped_ref_ptr.h"
|
|
#include "webrtc/base/sslidentity.h"
|
|
#include "webrtc/base/thread.h"
|
|
|
|
namespace webrtc {
|
|
|
|
class SSLIdentity;
|
|
class Thread;
|
|
|
|
// Used to receive callbacks of DTLS identity requests.
|
|
class DtlsIdentityRequestObserver : public rtc::RefCountInterface {
|
|
public:
|
|
virtual void OnFailure(int error) = 0;
|
|
// TODO(hbos): Unify the OnSuccess method once Chrome code is updated.
|
|
virtual void OnSuccess(const std::string& der_cert,
|
|
const std::string& der_private_key) = 0;
|
|
// |identity| is a unique_ptr because rtc::SSLIdentity is not copyable and the
|
|
// client has to get the ownership of the object to make use of it.
|
|
virtual void OnSuccess(std::unique_ptr<rtc::SSLIdentity> identity) = 0;
|
|
|
|
protected:
|
|
virtual ~DtlsIdentityRequestObserver() {}
|
|
};
|
|
|
|
// This interface defines an in-memory DTLS identity store, which generates DTLS
|
|
// identities.
|
|
// APIs calls must be made on the signaling thread and the callbacks are also
|
|
// called on the signaling thread.
|
|
class DtlsIdentityStoreInterface {
|
|
public:
|
|
virtual ~DtlsIdentityStoreInterface() { }
|
|
|
|
// The |observer| will be called when the requested identity is ready, or when
|
|
// identity generation fails.
|
|
virtual void RequestIdentity(
|
|
const rtc::KeyParams& key_params,
|
|
const rtc::Optional<uint64_t>& expires_ms,
|
|
const rtc::scoped_refptr<DtlsIdentityRequestObserver>& observer) = 0;
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // WEBRTC_API_DTLSIDENTITYSTORE_H_
|