aboutsummaryrefslogtreecommitdiff
path: root/cast/sender/channel/cast_auth_util.h
diff options
context:
space:
mode:
authorYuri Wiitala <miu@chromium.org>2019-12-20 20:26:40 -0800
committerCommit Bot <commit-bot@chromium.org>2019-12-21 08:46:52 +0000
commit80ed3d779e3e38de94656bf59ff4b62534c797fe (patch)
tree7e5272420823e8f7a6bca54df9f259179d3fe126 /cast/sender/channel/cast_auth_util.h
parent14e7402b939822d20a2cf72e84cb72136301c4aa (diff)
downloadopenscreen-80ed3d779e3e38de94656bf59ff4b62534c797fe.tar.gz
Replace namespace cast::something with openscreen::cast.
...and fixed a few C++ style issues around use of rvals in files touched. Bug: openscreen:90 Change-Id: Ib14fb1c47dfafec1fefe0cad31bce764aae0272e Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/1959204 Commit-Queue: Yuri Wiitala <miu@chromium.org> Reviewed-by: Jordan Bayles <jophba@chromium.org>
Diffstat (limited to 'cast/sender/channel/cast_auth_util.h')
-rw-r--r--cast/sender/channel/cast_auth_util.h57
1 files changed, 26 insertions, 31 deletions
diff --git a/cast/sender/channel/cast_auth_util.h b/cast/sender/channel/cast_auth_util.h
index df6299d3..467dfb82 100644
--- a/cast/sender/channel/cast_auth_util.h
+++ b/cast/sender/channel/cast_auth_util.h
@@ -7,28 +7,25 @@
#include <openssl/x509.h>
-#include <chrono>
+#include <chrono> // NOLINT
#include <string>
#include "cast/common/certificate/cast_cert_validator.h"
#include "platform/base/error.h"
namespace cast {
-namespace certificate {
-enum class CRLPolicy;
-struct DateTime;
-struct TrustStore;
-} // namespace certificate
-} // namespace cast
-
-namespace cast {
namespace channel {
-
class AuthResponse;
class CastMessage;
+} // namespace channel
+} // namespace cast
+
+namespace openscreen {
+namespace cast {
-using openscreen::ErrorOr;
-using CastDeviceCertPolicy = certificate::CastDeviceCertPolicy;
+enum class CRLPolicy;
+struct DateTime;
+struct TrustStore;
class AuthContext {
public:
@@ -40,9 +37,8 @@ class AuthContext {
// Verifies the nonce received in the response is equivalent to the one sent.
// Returns success if |nonce_response| matches nonce_
- openscreen::Error VerifySenderNonce(
- const std::string& nonce_response,
- bool enforce_nonce_checking = false) const;
+ Error VerifySenderNonce(const std::string& nonce_response,
+ bool enforce_nonce_checking = false) const;
// The nonce challenge.
const std::string& nonce() const { return nonce_; }
@@ -57,7 +53,7 @@ class AuthContext {
// 1. Signature contained in the reply is valid.
// 2. certificate used to sign is rooted to a trusted CA.
ErrorOr<CastDeviceCertPolicy> AuthenticateChallengeReply(
- const CastMessage& challenge_reply,
+ const ::cast::channel::CastMessage& challenge_reply,
X509* peer_cert,
const AuthContext& auth_context);
@@ -66,24 +62,23 @@ ErrorOr<CastDeviceCertPolicy> AuthenticateChallengeReply(
// Overloaded version of AuthenticateChallengeReply that allows modifying the
// crl policy, trust stores, and verification times.
ErrorOr<CastDeviceCertPolicy> AuthenticateChallengeReplyForTest(
- const CastMessage& challenge_reply,
+ const ::cast::channel::CastMessage& challenge_reply,
X509* peer_cert,
const AuthContext& auth_context,
- certificate::CRLPolicy crl_policy,
- certificate::TrustStore* cast_trust_store,
- certificate::TrustStore* crl_trust_store,
- const certificate::DateTime& verification_time);
+ CRLPolicy crl_policy,
+ TrustStore* cast_trust_store,
+ TrustStore* crl_trust_store,
+ const DateTime& verification_time);
// Performs a quick check of the TLS certificate for time validity requirements.
-openscreen::Error VerifyTLSCertificateValidity(
- X509* peer_cert,
- std::chrono::seconds verification_time);
+Error VerifyTLSCertificateValidity(X509* peer_cert,
+ std::chrono::seconds verification_time);
// Auth-library specific implementation of cryptographic signature verification
// routines. Verifies that |response| contains a valid signature of
// |signature_input|.
ErrorOr<CastDeviceCertPolicy> VerifyCredentials(
- const AuthResponse& response,
+ const ::cast::channel::AuthResponse& response,
const std::string& signature_input,
bool enforce_revocation_checking = false,
bool enforce_sha256_checking = false);
@@ -93,15 +88,15 @@ ErrorOr<CastDeviceCertPolicy> VerifyCredentials(
// Overloaded version of VerifyCredentials that allows modifying the crl policy,
// trust stores, and verification times.
ErrorOr<CastDeviceCertPolicy> VerifyCredentialsForTest(
- const AuthResponse& response,
+ const ::cast::channel::AuthResponse& response,
const std::string& signature_input,
- certificate::CRLPolicy crl_policy,
- certificate::TrustStore* cast_trust_store,
- certificate::TrustStore* crl_trust_store,
- const certificate::DateTime& verification_time,
+ CRLPolicy crl_policy,
+ TrustStore* cast_trust_store,
+ TrustStore* crl_trust_store,
+ const DateTime& verification_time,
bool enforce_sha256_checking = false);
-} // namespace channel
} // namespace cast
+} // namespace openscreen
#endif // CAST_SENDER_CHANNEL_CAST_AUTH_UTIL_H_