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  * Additional permission under GNU GPL version 3 section 7
20  *
21  * If you modify this Program, or any covered work, by linking or combining it
22  * with OpenSSL (or a modified version of that library), containing
23  * parts covered by the terms of OpenSSL's license, the licensors of
24  * this Program grant you additional permission to convey the resulting work.
25  * Corresponding Source for a non-source form of such a combination shall include
26  * the source code for the parts of OpenSSL used as well as that of the
27  * covered work.
28  *
29  * If you modify this Program, or any covered work, by linking or combining it
30  * with OpenSC (or a modified version of that library), containing
31  * parts covered by the terms of OpenSC's license, the licensors of
32  * this Program grant you additional permission to convey the resulting work.
33  * Corresponding Source for a non-source form of such a combination shall include
34  * the source code for the parts of OpenSC used as well as that of the
35  * covered work.
36  */
37 
53 #ifndef CA_H_
54 #define CA_H_
55 
56 #include "eac.h"
57 #include <openssl/buffer.h>
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
64 #define CA_FLAG_DISABLE_PASSIVE_AUTH 1
65 
77 
91 BUF_MEM *
92 CA_get_pubkey(const EAC_CTX *ctx,
93  const unsigned char *ef_cardsecurity,
94  size_t ef_cardsecurity_len);
95 
109 int
110 CA_set_key(const EAC_CTX *ctx,
111  const unsigned char *priv, size_t priv_len,
112  const unsigned char *pub, size_t pub_len);
127 BUF_MEM *
128 CA_STEP1_get_pubkey(const EAC_CTX *ctx);
138 BUF_MEM *
139 CA_STEP2_get_eph_pubkey(const EAC_CTX *ctx);
152 int
154  const BUF_MEM *comp_pubkey, const BUF_MEM *pubkey);
168 int
169 CA_STEP4_compute_shared_secret(const EAC_CTX *ctx, const BUF_MEM *pubkey);
170 
183 int
184 CA_STEP5_derive_keys(const EAC_CTX *ctx, const BUF_MEM *pub,
185  BUF_MEM **nonce, BUF_MEM **token);
186 
198 int
199 CA_STEP6_derive_keys(EAC_CTX *ctx, const BUF_MEM *nonce, const BUF_MEM *token);
200 
203 #ifdef __cplusplus
204 }
205 #endif
206 #endif
eac.h
Interface for Extended Access Control.
CA_STEP2_get_eph_pubkey
BUF_MEM * CA_STEP2_get_eph_pubkey(const EAC_CTX *ctx)
Get the PCD's ephemeral public key (generated in TA step 3)
CA_set_key
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.
CA_disable_passive_authentication
void CA_disable_passive_authentication(EAC_CTX *ctx)
Disable passive authentication for this EAC_CTX.
CA_STEP4_compute_shared_secret
int CA_STEP4_compute_shared_secret(const EAC_CTX *ctx, const BUF_MEM *pubkey)
Compute the shared secret using the PICC's static key pair and the PCD's ephemeral key pair.
eac_ctx
Context for the Extended Access Control protocol.
Definition: eac.h:342
CA_STEP1_get_pubkey
BUF_MEM * CA_STEP1_get_pubkey(const EAC_CTX *ctx)
Get the PICC's encoded public key.
CA_get_pubkey
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.
CA_STEP3_check_pcd_pubkey
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.
CA_STEP5_derive_keys
int CA_STEP5_derive_keys(const EAC_CTX *ctx, const BUF_MEM *pub, BUF_MEM **nonce, BUF_MEM **token)
Derives the PICC's encryption and authentication keys.
CA_STEP6_derive_keys
int CA_STEP6_derive_keys(EAC_CTX *ctx, const BUF_MEM *nonce, const BUF_MEM *token)
Derives the PCD's encryption and authentication keys.