Botan 1.10.17

cvc_self.h
Go to the documentation of this file.
1 /*
2 * CVC Self-Signed Certificate
3 * (C) 2007 FlexSecure GmbH
4 * 2008 Jack Lloyd
5 *
6 * Distributed under the terms of the Botan license
7 */
8
9 #ifndef BOTAN_CVC_EAC_SELF_H__
10 #define BOTAN_CVC_EAC_SELF_H__
11
12 #include <botan/pkcs8.h>
13 #include <botan/cvc_cert.h>
14 #include <botan/ecdsa.h>
15 #include <botan/asn1_obj.h>
16 #include <botan/cvc_req.h>
17 #include <botan/cvc_ado.h>
18
19 namespace Botan {
20
21 /**
22 * This class represents a set of options used for the creation of CVC certificates
23 */
24 class BOTAN_DLL EAC1_1_CVC_Options
25 {
26 public:
27
28 ASN1_Car car;
29 ASN1_Chr chr;
30 byte holder_auth_templ;
31 ASN1_Ced ced;
32 ASN1_Cex cex;
33 std::string hash_alg;
34 };
35
36 /**
37 * This namespace represents general EAC 1.1 convenience functions.
38 */
39 namespace CVC_EAC {
40
41 /**
42 * Create a selfsigned CVCA
43 * @param rng the rng to use
44 * @param key the ECDSA private key to be used to sign the certificate
45 * @param opts used to set several parameters. Necessary are:
46 * car, holder_auth_templ, hash_alg, ced, cex and hash_alg
47 * @result the self signed certificate
48 */
49
50 EAC1_1_CVC BOTAN_DLL create_self_signed_cert(Private_Key const& key,
51 EAC1_1_CVC_Options const& opts,
52 RandomNumberGenerator& rng);
53 /**
54 * Create a CVC request. The key encoding will be according to the provided private key.
55 * @param priv_key the private key associated with the requesting entity
56 * @param chr the chr to appear in the certificate (to be provided without
57 * sequence number)
58 * @param hash_alg the string defining the hash algorithm to be used for the creation
59 * of the signature
60 * @param rng the rng to use
61 * @result the new request
62 */
63 EAC1_1_Req BOTAN_DLL create_cvc_req(Private_Key const& priv_key,
64 ASN1_Chr const& chr,
65 std::string const& hash_alg,
66 RandomNumberGenerator& rng);
67
68 /**
69 * Create an ADO from a request object.
70 * @param priv_key the private key used to sign the ADO
71 * @param req the request forming the body of the ADO
72 * @param car the CAR forming the body of the ADO, i.e. the
73 * CHR of the entity associated with the provided private key
74 * @param rng the rng to use
75 */
76 EAC1_1_ADO BOTAN_DLL create_ado_req(Private_Key const& priv_key,
77 EAC1_1_Req const& req,
78 ASN1_Car const& car,
79 RandomNumberGenerator& rng);
80 }
81 /**
82 * This namespace represents EAC 1.1 CVC convenience functions
83 * following the specific german requirements.
84 */
85
86 namespace DE_EAC {
87
88 /**
89 * Create a CVCA certificate.
90 * @param priv_key the private key associated with the CVCA certificate
91 * to be created
92 * @param hash the string identifying the hash algorithm to be used
93 * for signing the certificate to be created
94 * @param car the CAR of the certificate to be created
95 * @param iris indicates whether the entity associated with the certificate
96 * shall be entitled to read the biometrical iris image
97 * @param fingerpr indicates whether the entity associated with the certificate
98 * shall be entitled to read the biometrical fingerprint image
99 * @param cvca_validity_months length of time in months this will be valid
100 * @param rng a random number generator
101 * @result the CVCA certificate created
102 */
103 EAC1_1_CVC BOTAN_DLL create_cvca(Private_Key const& priv_key,
104 std::string const& hash,
105 ASN1_Car const& car,
106 bool iris,
107 bool fingerpr,
108 u32bit cvca_validity_months,
109 RandomNumberGenerator& rng);
110
111 /**
112 * Create a link certificate between two CVCA certificates. The key
113 * encoding will be implicitCA.
114 * @param signer the cvca certificate associated with the signing
115 * entity
116 * @param priv_key the private key associated with the signer
117 * @param to_be_signed the certificate which whose CAR/CHR will be
118 * the holder of the link certificate
119 * @param rng a random number generator
120 */
121 EAC1_1_CVC BOTAN_DLL link_cvca(EAC1_1_CVC const& signer,
122 Private_Key const& priv_key,
123 EAC1_1_CVC const& to_be_signed,
124 RandomNumberGenerator& rng);
125
126 /**
127 * Create a CVC request. The key encoding will be implicitCA.
128 * @param priv_key the private key associated with the requesting entity
129 * @param chr the chr to appear in the certificate (to be provided without
130 * sequence number)
131 * @param hash_alg the string defining the hash algorithm to be used for the creation
132 * of the signature
133 * @param rng a random number generator
134 * @result the new request
135 */
136 EAC1_1_Req BOTAN_DLL create_cvc_req(Private_Key const& priv_key,
137 ASN1_Chr const& chr,
138 std::string const& hash_alg,
139 RandomNumberGenerator& rng);
140
141 /**
142 * Sign a CVC request.
143 * @param signer_cert the certificate of the signing entity
144 * @param priv_key the private key of the signing entity
145 * @param req the request to be signed
146 * @param seqnr the sequence number of the certificate to be created
147 * @param seqnr_len the number of digits the sequence number will be
148 * encoded in
149 * @param domestic indicates whether to sign a domestic or a foreign
150 * certificate: set to true for domestic
151 * @param dvca_validity_months validity period in months
152 * @param ca_is_validity_months validity period in months
153 * @param rng a random number generator
154 * @result the new certificate
155 *
156 **/
157 EAC1_1_CVC BOTAN_DLL sign_request(EAC1_1_CVC const& signer_cert,
158 Private_Key const& priv_key,
159 EAC1_1_Req const& req,
160 u32bit seqnr,
161 u32bit seqnr_len,
162 bool domestic,
163 u32bit dvca_validity_months,
164 u32bit ca_is_validity_months,
165 RandomNumberGenerator& rng);
166 }
167
168 }
169
170 #endif
Botan::EAC1_1_Req
Definition: cvc_req.h:19
Botan::EAC1_1_CVC_Options
Definition: cvc_self.h:24
Botan::EAC1_1_CVC
Definition: cvc_cert.h:21
Botan::EAC1_1_CVC_Options::cex
ASN1_Cex cex
Definition: cvc_self.h:32
Botan::RandomNumberGenerator
Definition: rng.h:20
Botan::ASN1_Cex
Definition: eac_asn_obj.h:139
Botan::Private_Key
Definition: pk_keys.h:86
Botan::CVC_EAC::create_ado_req
EAC1_1_ADO create_ado_req(Private_Key const &key, EAC1_1_Req const &req, ASN1_Car const &car, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:156
Botan::EAC1_1_CVC_Options::car
ASN1_Car car
Definition: cvc_self.h:28
Botan::EAC1_1_CVC_Options::chr
ASN1_Chr chr
Definition: cvc_self.h:29
Botan::DE_EAC::link_cvca
EAC1_1_CVC link_cvca(EAC1_1_CVC const &signer, Private_Key const &key, EAC1_1_CVC const &signee, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:208
Botan::DE_EAC::sign_request
EAC1_1_CVC sign_request(EAC1_1_CVC const &signer_cert, Private_Key const &key, EAC1_1_Req const &signee, u32bit seqnr, u32bit seqnr_len, bool domestic, u32bit dvca_validity_months, u32bit ca_is_validity_months, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:249
Botan::byte
unsigned char byte
Definition: types.h:22
Botan::EAC1_1_CVC_Options::hash_alg
std::string hash_alg
Definition: cvc_self.h:33
Botan
Definition: algo_base.h:14
Botan::ASN1_Car
Definition: eac_asn_obj.h:201
Botan::CVC_EAC::create_self_signed_cert
EAC1_1_CVC create_self_signed_cert(Private_Key const &key, EAC1_1_CVC_Options const &opt, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:90
Botan::DE_EAC::create_cvca
EAC1_1_CVC create_cvca(Private_Key const &key, std::string const &hash, ASN1_Car const &car, bool iris, bool fingerpr, u32bit cvca_validity_months, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:183
Botan::CVC_EAC::create_cvc_req
EAC1_1_Req create_cvc_req(Private_Key const &key, ASN1_Chr const &chr, std::string const &hash_alg, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:119
Botan::EAC1_1_CVC_Options::ced
ASN1_Ced ced
Definition: cvc_self.h:31
Botan::EAC1_1_CVC_Options::holder_auth_templ
byte holder_auth_templ
Definition: cvc_self.h:30
Botan::EAC1_1_ADO
Definition: cvc_ado.h:23
Botan::ASN1_Chr
Definition: eac_asn_obj.h:214
Botan::ASN1_Ced
Definition: eac_asn_obj.h:108
Botan::u32bit
unsigned int u32bit
Definition: types.h:32
Botan::DE_EAC::create_cvc_req
EAC1_1_Req create_cvc_req(Private_Key const &prkey, ASN1_Chr const &chr, std::string const &hash_alg, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:317