NAVTOR SDK  v.3.0
Software Development Kit for fast and efficient development of ECDIS, ECS and generic marine applications
s63_keys_conversion_interface.h
Go to the documentation of this file.
1 #ifndef SDK_S63_KEYS_CONVERSION_INTERFACE_H_
12 #define SDK_S63_KEYS_CONVERSION_INTERFACE_H_
13 
14 #include <base/inc/base_types.h>
16 #include <base/inc/sdk_ref_ptr.h>
18 
19 namespace sdk {
20 namespace s63 {
21 
22 typedef SDKUInt8 HW_ID[5]; // S-63 HW_ID
23 typedef SDKUInt8 M_ID[2]; // S-63 M_ID
24 typedef SDKUInt8 M_KEY[5]; // S-63 M_KEY
25 typedef SDKUInt8 UserPermit[28]; // S-63 UserPermit
26 
27 static inline void AssignHW_ID(HW_ID& to, const SDKUInt8* from) {
28  if (from) {
29  to[0] = from[0]; to[1] = from[1]; to[2] = from[2]; to[3] = from[3];
30  to[4] = from[4];
31  }
32 }
33 
34 static inline bool AssignHW_ID(HW_ID& to, const char* from, size_t size) {
35  if (size >= sizeof(to)) {
36  if (from) {
37  to[0] = from[0]; to[1] = from[1]; to[2] = from[2]; to[3] = from[3];
38  to[4] = from[4];
39  return true;
40  }
41  }
42  return false;
43 }
44 
45 static inline void AssignM_ID(M_ID& to, const SDKUInt8* from) {
46  if (from) {
47  to[0] = from[0]; to[1] = from[1];
48  }
49 }
50 
51 static inline void AssignM_KEY(M_KEY& to, const SDKUInt8* from) {
52  if (from) {
53  to[0] = from[0]; to[1] = from[1]; to[2] = from[2]; to[3] = from[3];
54  to[4] = from[4];
55  }
56 }
57 
58 
59 FWD_DECL_INTERFACE(IS63KeysConversion);
60 typedef sdk::SDKRefPtr<IS63KeysConversion> S63KeysConversionSP;
61 
65 {
67 };
68 
72 class IS63KeysConversion : public sdk::ISDKComponent
73 {
74  public:
77  virtual SDKResult SDK_CALLTYPE GetCryptoKeyByHWID(const HW_ID& hw_id,
78  sdk::crypt::SymmetricCryptoKeyData& key_data) const throw() = 0;
79 
82  virtual SDKResult SDK_CALLTYPE GetCryptoKeyByMKey(const M_KEY& m_key,
83  const UserPermit& user_permit,
84  sdk::crypt::SymmetricCryptoKeyData& key_data) const throw() = 0;
85 
87  virtual SDKResult SDK_CALLTYPE GetUserPermit(const HW_ID& hw_id,
88  const M_KEY& m_key, const M_ID& m_id,
89  UserPermit& user_permit) const throw() = 0;
90 
92  virtual SDKResult SDK_CALLTYPE ParseUserPermit(const M_KEY& m_key,
93  const UserPermit& user_permit, HW_ID& hw_id,
94  M_ID& m_id) const throw() = 0;
95 
97 
99  SDK_IMPLEMENT_IID(IS63KeysConversion)
100  SDK_END_INTERFACE(IS63KeysConversion)
101 };
102 SDK_DECLARE_IID(IS63KeysConversion)
103 
104 } // namespace s63
105 } // namespace sdk
106 
107 #endif // SDK_S63_KEYS_CONVERSION_INTERFACE_H_
crypt::SymmetricCryptoKeyData
SDKArray SymmetricCryptoKeyData
ISymmetric cryptographic key data.
Definition: symmetric_crypto_key_interface.h:29
base_types.h
SDK base types.
sdk::s63::IS63KeysConversion
The interface to perform conversions on HW_ID, M_ID, M_KEY, i.e. to get/parse the UserPermit,...
Definition: s63_keys_conversion_interface.h:72
symmetric_crypto_key_interface.h
Interface for symmetric cryptographic key implementation.
sdk::s63::S63KeysConversionProps
S63KeysConversionProps
Keys converions properties.
Definition: s63_keys_conversion_interface.h:64
sdk_ref_ptr.h
Interfaces wrapper with reference count control.
sdk::s63::IS63KeysConversion::GetUserPermit
virtual SDKResult SDK_CALLTYPE GetUserPermit(const HW_ID &hw_id, const M_KEY &m_key, const M_ID &m_id, UserPermit &user_permit) const =0
Generates an S-63 UserPermit using HW_ID/M_KEY/M_ID.
sdk::s63::IS63KeysConversion::GetCryptoKeyByHWID
virtual SDKResult SDK_CALLTYPE GetCryptoKeyByHWID(const HW_ID &hw_id, sdk::crypt::SymmetricCryptoKeyData &key_data) const =0
Generates a Cryptographic Key for S-63 cell permits decryption using HW_ID.
sdk::s63::IS63KeysConversion::ParseUserPermit
virtual SDKResult SDK_CALLTYPE ParseUserPermit(const M_KEY &m_key, const UserPermit &user_permit, HW_ID &hw_id, M_ID &m_id) const =0
Extracts the HW_ID/M_ID from the S-63 UserPermit.
SDKResult
SDKInt32 SDKResult
Type of all error or return codes which SDK functions can end with.
Definition: sdk_results.h:17
sdk::s63::IS63KeysConversion::GetCryptoKeyByMKey
virtual SDKResult SDK_CALLTYPE GetCryptoKeyByMKey(const M_KEY &m_key, const UserPermit &user_permit, sdk::crypt::SymmetricCryptoKeyData &key_data) const =0
Generates a Cryptographic Key for S-63 cell permits decryption using M_KEY and UserPermit.
sdk_component_interface.h
Common base SDK interfaces.
sdk::s63::kS63KeysConversionProp_CheckHWIDFormat
@ kS63KeysConversionProp_CheckHWIDFormat
Check HW_ID format flag, kSDKAnyType_Bool.
Definition: s63_keys_conversion_interface.h:66
FWD_DECL_INTERFACE
FWD_DECL_INTERFACE(ILWEParserWrapper)
Provides a wrapper around the message parser to get, add or remove the.