Program Listing for File CryptoKeyFactory.h
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/rtps/security/cryptography/CryptoKeyFactory.h
)
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _FASTDDS_RTPS_SECURITY_CRYPTOGRAPHY_CRYPTOKEYFACTORY_H_
#define _FASTDDS_RTPS_SECURITY_CRYPTOGRAPHY_CRYPTOKEYFACTORY_H_
#include <fastdds/rtps/security/cryptography/CryptoTypes.h>
#include <fastdds/rtps/security/accesscontrol/EndpointSecurityAttributes.h>
#include <fastdds/rtps/security/accesscontrol/ParticipantSecurityAttributes.h>
#include <memory>
namespace eprosima {
namespace fastrtps {
namespace rtps {
namespace security {
class CryptoKeyFactory
{
public:
virtual ~CryptoKeyFactory()
{
}
virtual std::shared_ptr<ParticipantCryptoHandle> register_local_participant(
const IdentityHandle& participant_identity,
const PermissionsHandle& participant_permissions,
const PropertySeq& participant_properties,
const ParticipantSecurityAttributes& participant_security_attributes,
SecurityException& exception) = 0;
virtual std::shared_ptr<ParticipantCryptoHandle> register_matched_remote_participant(
const ParticipantCryptoHandle& local_participant_crypto_handle,
const IdentityHandle& remote_participant_identity,
const PermissionsHandle& remote_participant_permissions,
const SecretHandle& shared_secret,
SecurityException& exception) = 0;
virtual DatawriterCryptoHandle* register_local_datawriter(
ParticipantCryptoHandle& participant_crypto,
const PropertySeq& datawriter_prop,
const EndpointSecurityAttributes& datawriter_sec_attr,
SecurityException& exception) = 0;
virtual DatareaderCryptoHandle* register_matched_remote_datareader(
DatawriterCryptoHandle& local_datawriter_crypto_handle,
ParticipantCryptoHandle& remote_participant_crypto,
const SecretHandle& shared_secret,
const bool relay_only,
SecurityException& exception) = 0;
virtual DatareaderCryptoHandle* register_local_datareader(
ParticipantCryptoHandle& participant_crypto,
const PropertySeq& datareader_properties,
const EndpointSecurityAttributes& datareader_security_attributes,
SecurityException& exception) = 0;
virtual DatawriterCryptoHandle* register_matched_remote_datawriter(
DatareaderCryptoHandle& local_datareader_crypto_handle,
ParticipantCryptoHandle& remote_participant_crypt,
const SecretHandle& shared_secret,
SecurityException& exception) = 0;
virtual bool unregister_participant(
std::shared_ptr<ParticipantCryptoHandle>& participant_crypto_handle,
SecurityException& exception) = 0;
virtual bool unregister_datawriter(
std::shared_ptr<DatawriterCryptoHandle>& datawriter_crypto_handle,
SecurityException& exception) = 0;
bool unregister_datawriter(
DatawriterCryptoHandle* datawriter_crypto_handle,
SecurityException& exception)
{
if (nullptr == datawriter_crypto_handle)
{
return false;
}
try
{
auto temp = datawriter_crypto_handle->shared_from_this();
return unregister_datawriter(temp, exception);
}
catch (std::bad_weak_ptr&)
{
return false;
}
}
virtual bool unregister_datareader(
std::shared_ptr<DatareaderCryptoHandle>& datareader_crypto_handle,
SecurityException& exception) = 0;
bool unregister_datareader(
DatareaderCryptoHandle* datareader_crypto_handle,
SecurityException& exception)
{
if (nullptr == datareader_crypto_handle)
{
return false;
}
try
{
auto temp = datareader_crypto_handle->shared_from_this();
return unregister_datareader(temp, exception);
}
catch (std::bad_weak_ptr&)
{
return false;
}
}
};
} //namespace security
} //namespace rtps
} //namespace fastrtps
} //namespace eprosima
#endif //_FASTDDS_RTPS_SECURITY_CRYPTOGRAPHY_CRYPTOKEYFACTORY_H_