LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
RemoteCrypto.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace logicalaccess
6{
7// mostly copy-past protobuf SignatureResult message.
9{
11 {
13 uint64_t nonce{};
15 uint64_t timestamp{};
17
18 // Cryptographic signature over proto_serialized_desc
20};
21
22// mostly copy-paste protobuf KeyDiversificationInfo
24{
25 std::string div_type; // support only NXPAV2
27};
28
36{
37 public:
47 virtual bool verify_signature(const SignatureResult &sr,
48 const std::string &pubkey_pem) = 0;
49
50 virtual ByteVector aes_encrypt(const ByteVector &in, const std::string &key_name,
51 const ByteVector &iv) = 0;
52
53 virtual ByteVector aes_decrypt(const ByteVector &in, const std::string &key_name,
54 const ByteVector &iv,
55 SignatureResult *out_signature = nullptr) = 0;
56
57 virtual void iso_authenticate_step1(const std::string &key_identity,
58 const ByteVector &random_picc,
59 const MyDivInfo &div_info, bool &out_success,
60 ByteVector &out_random2,
61 ByteVector &out_encrypted_cryptogram,
62 ByteVector &out_auth_context_id) = 0;
63
64 virtual void iso_authenticate_step2(const std::string &key_identity,
65 const ByteVector &picc_cryptogram,
66 const ByteVector &auth_context_id,
67 const MyDivInfo &div_info, bool &out_success,
68 ByteVector &out_session_key,
69 ByteVector &out_session_key_ref) = 0;
70
71 virtual void aes_authenticate_step1(const std::string &key_identity,
72 const ByteVector &encrypted_random_picc,
73 const MyDivInfo &div_info, bool &out_success,
74 ByteVector &out_encrypted_cryptogram,
75 ByteVector &out_auth_context_id) = 0;
76
77 virtual void aes_authenticate_step2(const std::string &key_identity,
78 const ByteVector &picc_cryptogram,
79 const ByteVector &auth_context_id,
80 const MyDivInfo &div_info, bool &out_success,
81 ByteVector &out_session_key,
82 ByteVector &out_session_key_ref) = 0;
83
87 virtual void change_key(const std::string &old_key_identity,
88 const std::string &new_key_identity, bool change_same_key,
89 const std::string &session_key_uuid,
90 const ByteVector &session_key, const MyDivInfo &old_key_div,
91 const MyDivInfo &new_key_div, uint8_t key_no,
92 const ByteVector &iv, ByteVector &out_cryptogram) = 0;
93};
94}
Definition: RemoteCrypto.hpp:36
virtual 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)=0
virtual 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)=0
virtual 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)=0
virtual ByteVector aes_decrypt(const ByteVector &in, const std::string &key_name, const ByteVector &iv, SignatureResult *out_signature=nullptr)=0
virtual bool verify_signature(const SignatureResult &sr, const std::string &pubkey_pem)=0
virtual 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)=0
virtual ByteVector aes_encrypt(const ByteVector &in, const std::string &key_name, const ByteVector &iv)=0
virtual 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)=0
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9
Definition: RemoteCrypto.hpp:24
std::string div_type
Definition: RemoteCrypto.hpp:25
ByteVector div_input
Definition: RemoteCrypto.hpp:26
Definition: RemoteCrypto.hpp:11
ByteVector payload
Definition: RemoteCrypto.hpp:12
uint64_t timestamp
Definition: RemoteCrypto.hpp:15
uint64_t nonce
Definition: RemoteCrypto.hpp:13
ByteVector run_uuid
Definition: RemoteCrypto.hpp:14
Definition: RemoteCrypto.hpp:9
ByteVector signature
Definition: RemoteCrypto.hpp:19
struct logicalaccess::SignatureResult::Description desc