00001 /* 00002 * Distributed under the OpenDDS License. 00003 * See: http://www.OpenDDS.org/license.html 00004 */ 00005 00006 #ifndef OPENDDS_SECURITY_SSL_UTILS_H 00007 #define OPENDDS_SECURITY_SSL_UTILS_H 00008 00009 #include "Certificate.h" 00010 #include "PrivateKey.h" 00011 #include "dds/DdsDcpsGuidC.h" 00012 #include "dds/DdsDcpsCoreC.h" 00013 #include <string> 00014 00015 namespace OpenDDS { 00016 namespace Security { 00017 namespace SSL { 00018 00019 DdsSecurity_Export int make_adjusted_guid(const OpenDDS::DCPS::GUID_t& src, 00020 OpenDDS::DCPS::GUID_t& dst, 00021 const Certificate& target); 00022 00023 /** 00024 * @return int 0 on success; 1 on failure. 00025 */ 00026 DdsSecurity_Export int make_nonce_256(std::vector<unsigned char>& nonce); 00027 00028 /** 00029 * @return int 0 on success; 1 on failure. 00030 */ 00031 DdsSecurity_Export int make_nonce_256(DDS::OctetSeq& nonce); 00032 00033 /// Gets byte from array as though it were shifted right one bit 00034 DdsSecurity_Export unsigned char offset_1bit(const unsigned char array[], 00035 size_t i); 00036 00037 /** 00038 * @return int 0 on success; 1 on failure. 00039 */ 00040 DdsSecurity_Export int hash(const std::vector<const DDS::OctetSeq*>& src, 00041 DDS::OctetSeq& dst); 00042 00043 /** 00044 * @return int 0 on success; 1 on failure. 00045 */ 00046 DdsSecurity_Export int hash_serialized(const DDS::BinaryPropertySeq& src, 00047 DDS::OctetSeq& dst); 00048 00049 /** 00050 * @return int 0 on success; 1 on failure. 00051 */ 00052 DdsSecurity_Export int sign_serialized(const DDS::BinaryPropertySeq& src, 00053 const PrivateKey& key, 00054 DDS::OctetSeq& dst); 00055 00056 /** 00057 * @return int 0 on success; 1 on failure. 00058 */ 00059 DdsSecurity_Export int verify_serialized(const DDS::BinaryPropertySeq& src, 00060 const Certificate& key, 00061 const DDS::OctetSeq& signed_data); 00062 00063 } // namespace SSL 00064 } // namespace Security 00065 } // namespace OpenDDS 00066 00067 #endif