LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
IKSRPCClient.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <grpc/grpc.h>
5#include <grpc++/channel.h>
6#include <grpc++/client_context.h>
7#include <grpc++/create_channel.h>
8#include <grpc++/security/credentials.h>
12
13namespace logicalaccess
14{
15namespace iks
16{
17
22{
23 public:
25
26 ByteVector gen_random(int size);
27
28 ByteVector aes_encrypt(const ByteVector &in, const std::string &key_name,
29 const ByteVector &iv);
30
31 ByteVector aes_decrypt(const ByteVector &in, const std::string &key_name,
32 const ByteVector &iv,
33 ::logicalaccess::SignatureResult *out_signature = nullptr);
34
37
40
42
43 private:
45 std::shared_ptr<::grpc::ChannelInterface> channel;
46 std::unique_ptr<IKSService::Stub> stub_;
47};
48
53{
54 public:
56
57 bool verify_signature(const SignatureResult &sr,
58 const std::string &pubkey_pem) override;
59
60 ByteVector aes_encrypt(const ByteVector &in, const std::string &key_name,
61 const ByteVector &iv) override;
62
63 ByteVector aes_decrypt(const ByteVector &in, const std::string &key_name,
64 const ByteVector &iv, SignatureResult *out_signature) override;
65
66 void iso_authenticate_step1(const std::string &key_identity,
67 const ByteVector &random_picc, const MyDivInfo &div_info,
68 bool &out_success, ByteVector &out_random2,
69 ByteVector &out_encrypted_cryptogram,
70 ByteVector &out_auth_context_id) override;
71
72 void iso_authenticate_step2(const std::string &key_identity,
73 const ByteVector &picc_cryptogram,
74 const ByteVector &auth_context_id,
75 const MyDivInfo &div_info, bool &out_success,
76 ByteVector &out_session_key,
77 ByteVector &out_session_key_ref) override;
78
79 void aes_authenticate_step1(const std::string &key_identity,
80 const ByteVector &encrypted_random_picc,
81 const MyDivInfo &div_info, bool &out_success,
82 ByteVector &out_encrypted_cryptogram,
83 ByteVector &out_auth_context_id) override;
84
85 void aes_authenticate_step2(const std::string &key_identity,
86 const ByteVector &picc_cryptogram,
87 const ByteVector &auth_context_id,
88 const MyDivInfo &div_info, bool &out_success,
89 ByteVector &out_session_key,
90 ByteVector &out_session_key_ref) override;
91
92 void change_key(const std::string &old_key_identity,
93 const std::string &new_key_identity, bool change_same_key,
94 const std::string &session_key_uuid, const ByteVector &session_key,
95 const MyDivInfo &old_key_div, const MyDivInfo &new_key_div,
96 uint8_t key_no, const ByteVector &iv,
97 ByteVector &out_cryptogram) override;
98
99 private:
104
106};
107}
108}
Definition: iks.pb.h:1571
Definition: iks.pb.h:2261
Definition: iks.pb.h:497
Definition: iks.pb.h:1908
Definition: iks.pb.h:144
Definition: iks.pb.h:1744
Definition: iks.pb.h:2450
Definition: iks.pb.h:792
Definition: iks.pb.h:2081
Definition: RemoteCrypto.hpp:36
Definition: IKSRPCClient.hpp:22
std::shared_ptr<::grpc::ChannelInterface > channel
Definition: IKSRPCClient.hpp:45
ByteVector gen_random(int size)
Definition: IKSRPCClient.cpp:32
ByteVector aes_decrypt(const ByteVector &in, const std::string &key_name, const ByteVector &iv, ::logicalaccess::SignatureResult *out_signature=nullptr)
Definition: IKSRPCClient.cpp:65
SMSG_DesfireAuth_Step2 desfire_auth_aes_step2(CMSG_DesfireAuth_Step2 req)
Definition: IKSRPCClient.cpp:139
SMSG_DesfireChangeKey desfire_change_key(CMSG_DesfireChangeKey req)
Definition: IKSRPCClient.cpp:152
SMSG_DesfireISOAuth_Step1 desfire_auth_iso_step1(CMSG_DesfireISOAuth_Step1 req)
Definition: IKSRPCClient.cpp:99
IslogKeyServer::IKSConfig config_
Definition: IKSRPCClient.hpp:44
std::unique_ptr< IKSService::Stub > stub_
Definition: IKSRPCClient.hpp:46
SMSG_DesfireAuth_Step2 desfire_auth_iso_step2(CMSG_DesfireAuth_Step2 req)
Definition: IKSRPCClient.cpp:112
SMSG_DesfireAESAuth_Step1 desfire_auth_aes_step1(CMSG_DesfireAESAuth_Step1 req)
Definition: IKSRPCClient.cpp:126
ByteVector aes_encrypt(const ByteVector &in, const std::string &key_name, const ByteVector &iv)
Definition: IKSRPCClient.cpp:47
Definition: IKSRPCClient.hpp:53
void aes_authenticate_step2(const std::string &key_identity, const ByteVector &picc_cryptogram, const ByteVector &auth_context_id, const MyDivInfo &div_info, bool &out_success, ByteVector &out_session_key, ByteVector &out_session_key_ref) override
Definition: IKSRPCClient.cpp:254
KeyDiversificationInfo convert_div_info(const MyDivInfo &)
Definition: IKSRPCClient.cpp:296
bool verify_signature(const SignatureResult &sr, const std::string &pubkey_pem) override
Definition: IKSRPCClient.cpp:170
ByteVector aes_decrypt(const ByteVector &in, const std::string &key_name, const ByteVector &iv, SignatureResult *out_signature) override
Definition: IKSRPCClient.cpp:191
void aes_authenticate_step1(const std::string &key_identity, const ByteVector &encrypted_random_picc, const MyDivInfo &div_info, bool &out_success, ByteVector &out_encrypted_cryptogram, ByteVector &out_auth_context_id) override
Definition: IKSRPCClient.cpp:236
void change_key(const std::string &old_key_identity, const std::string &new_key_identity, bool change_same_key, const std::string &session_key_uuid, const ByteVector &session_key, const MyDivInfo &old_key_div, const MyDivInfo &new_key_div, uint8_t key_no, const ByteVector &iv, ByteVector &out_cryptogram) override
Definition: IKSRPCClient.cpp:272
void iso_authenticate_step1(const std::string &key_identity, const ByteVector &random_picc, const MyDivInfo &div_info, bool &out_success, ByteVector &out_random2, ByteVector &out_encrypted_cryptogram, ByteVector &out_auth_context_id) override
Definition: IKSRPCClient.cpp:199
ByteVector aes_encrypt(const ByteVector &in, const std::string &key_name, const ByteVector &iv) override
Definition: IKSRPCClient.cpp:184
void iso_authenticate_step2(const std::string &key_identity, const ByteVector &picc_cryptogram, const ByteVector &auth_context_id, const MyDivInfo &div_info, bool &out_success, ByteVector &out_session_key, ByteVector &out_session_key_ref) override
Definition: IKSRPCClient.cpp:218
IKSRPCClient iks_rpc_client_
Definition: IKSRPCClient.hpp:105
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
Definition: RemoteCrypto.hpp:24
Definition: RemoteCrypto.hpp:9
Definition: IslogKeyServer.hpp:24