3 * @brief SCEP specific functions
5 * Contains functions to build and parse SCEP requests and replies
9 * Copyright (C) 2005 Jan Hutter, Martin Willi
10 * Hochschule fuer Technik Rapperswil
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 #include "../pluto/defs.h"
27 #include "../pluto/pkcs1.h"
28 #include "../pluto/pkcs7.h"
30 /* supported SCEP operation types */
36 /* SCEP pkiStatus values */
44 /* SCEP messageType values */
48 SCEP_GetCertInitial_MSG
,
54 /* SCEP failure reasons */
56 SCEP_badAlg_REASON
= 0,
57 SCEP_badMessageCheck_REASON
= 1,
58 SCEP_badRequest_REASON
= 2,
59 SCEP_badTime_REASON
= 3,
60 SCEP_badCertId_REASON
= 4,
61 SCEP_unknown_REASON
= 5
67 pkiStatus_t pkiStatus
;
71 chunk_t recipientNonce
;
74 extern const scep_attributes_t empty_scep_attributes
;
76 extern bool parse_attributes(chunk_t blob
, scep_attributes_t
*attrs
);
77 extern void scep_generate_pkcs10_fingerprint(chunk_t pkcs10
78 , chunk_t
*fingerprint
);
79 extern void scep_generate_transaction_id(const RSA_public_key_t
*rsak
80 , chunk_t
*transID
, chunk_t
*serialNumber
);
81 extern chunk_t
scep_transId_attribute(chunk_t transaction_id
);
82 extern chunk_t
scep_messageType_attribute(scep_msg_t m
);
83 extern chunk_t
scep_senderNonce_attribute(void);
84 extern chunk_t
scep_build_request(chunk_t data
, chunk_t transID
, scep_msg_t msg
85 , const x509cert_t
*enc_cert
, int enc_alg
86 , const x509cert_t
*signer_cert
, int digest_alg
87 , const RSA_private_key_t
*private_key
);
88 extern bool scep_http_request(const char *url
, chunk_t pkcs7
, scep_op_t op
89 , bool http_get_request
, chunk_t
*response
);
90 extern err_t
scep_parse_response(chunk_t response
, chunk_t transID
91 , contentInfo_t
*data
, scep_attributes_t
*attrs
, x509cert_t
*signer_cert
);