OpenPACE
ca.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2012 Frank Morgner and Dominik Oepen
3  *
4  * This file is part of OpenPACE.
5  *
6  * OpenPACE is free software: you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License as published by the Free
8  * Software Foundation, either version 3 of the License, or (at your option)
9  * any later version.
10  *
11  * OpenPACE is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * OpenPACE. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
35 #ifndef CA_H_
36 #define CA_H_
37 
38 #include "eac.h"
39 #include <openssl/buffer.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
46 #define CA_FLAG_DISABLE_PASSIVE_AUTH 1
47 
59 
73 BUF_MEM *
74 CA_get_pubkey(const EAC_CTX *ctx,
75  const unsigned char *ef_cardsecurity,
76  size_t ef_cardsecurity_len);
77 
91 int
92 CA_set_key(const EAC_CTX *ctx,
93  const unsigned char *priv, size_t priv_len,
94  const unsigned char *pub, size_t pub_len);
109 BUF_MEM *
110 CA_STEP1_get_pubkey(const EAC_CTX *ctx);
120 BUF_MEM *
121 CA_STEP2_get_eph_pubkey(const EAC_CTX *ctx);
134 int
136  const BUF_MEM *comp_pubkey, const BUF_MEM *pubkey);
150 int
151 CA_STEP4_compute_shared_secret(const EAC_CTX *ctx, const BUF_MEM *pubkey);
152 
165 int
166 CA_STEP5_derive_keys(const EAC_CTX *ctx, const BUF_MEM *pub,
167  BUF_MEM **nonce, BUF_MEM **token);
168 
180 int
181 CA_STEP6_derive_keys(EAC_CTX *ctx, const BUF_MEM *nonce, const BUF_MEM *token);
182 
185 #ifdef __cplusplus
186 }
187 #endif
188 #endif
Interface for Extended Access Control.
int CA_STEP6_derive_keys(EAC_CTX *ctx, const BUF_MEM *nonce, const BUF_MEM *token)
Derives the PCD&#39;s encryption and authentication keys.
BUF_MEM * CA_STEP1_get_pubkey(const EAC_CTX *ctx)
Get the PICC&#39;s encoded public key.
int CA_STEP5_derive_keys(const EAC_CTX *ctx, const BUF_MEM *pub, BUF_MEM **nonce, BUF_MEM **token)
Derives the PICC&#39;s encryption and authentication keys.
int CA_STEP3_check_pcd_pubkey(const EAC_CTX *ctx, const BUF_MEM *comp_pubkey, const BUF_MEM *pubkey)
Check whether the public key matches the compressed public key previously received in TA...
BUF_MEM * CA_get_pubkey(const EAC_CTX *ctx, const unsigned char *ef_cardsecurity, size_t ef_cardsecurity_len)
Extract the public key from a EF.CardSecurity file.
int CA_set_key(const EAC_CTX *ctx, const unsigned char *priv, size_t priv_len, const unsigned char *pub, size_t pub_len)
Initialize the CA context with keys.
Context for the Extended Access Control protocol.
Definition: eac.h:324
BUF_MEM * CA_STEP2_get_eph_pubkey(const EAC_CTX *ctx)
Get the PCD&#39;s ephemeral public key (generated in TA step 3)
int CA_STEP4_compute_shared_secret(const EAC_CTX *ctx, const BUF_MEM *pubkey)
Compute the shared secret using the PICC&#39;s static key pair and the PCD&#39;s ephemeral key pair...
void CA_disable_passive_authentication(EAC_CTX *ctx)
Disable passive authentication for this EAC_CTX.