Botan  1.10.9
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 
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 
51  EAC1_1_CVC_Options const& opts,
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,
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,
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
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
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
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
unsigned char byte
Definition: types.h:22
std::string hash_alg
Definition: cvc_self.h:33
RandomNumberGenerator * rng
Definition: global_rng.cpp:165
EAC1_1_CVC create_self_signed_cert(Private_Key const &key, EAC1_1_CVC_Options const &opt, RandomNumberGenerator &rng)
Definition: cvc_self.cpp:90
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
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
unsigned int u32bit
Definition: types.h:32
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