📄 eap_tls.hxx
字号:
void set_alert_level(ACE_Byte alert_level){ this->alert_level = alert_level;}; void set_alert_description(ACE_Byte alert_description){this-> alert_description = alert_description;}; void set_info_description(std::string &info_description){this->info_description = info_description;}; void set_record_len(ACE_INT32 record_len){this->record_len = record_len;}; void set_version(ACE_INT32 version){this->version = version;}; ACE_Byte get_origin() { return origin;}; ACE_Byte get_content_type() { return content_type;}; ACE_Byte get_handshake_type() {return handshake_type;}; ACE_Byte get_alert_level(){ return alert_level;}; ACE_Byte get_alert_description(){return alert_description;}; std::string &get_info_description(){return info_description;}; ACE_INT32 get_record_len(){return record_len;}; ACE_INT32 get_version(){return version;}; protected: ACE_Byte origin; ACE_Byte content_type; ACE_Byte handshake_type; ACE_Byte alert_level; ACE_Byte alert_description; std::string info_description; ACE_INT32 record_len; ACE_INT32 version;};class EAPTLS_config{ public: EAPTLS_config(std::string &private_key_password, std::string &private_key_file, std::string &certificate_file, std::string &random_file, std::string &ca_path, std::string &ca_file, std::string &dh_file, ACE_INT32 rsa_key, ACE_INT32 dh_key, ACE_INT32 rsa_key_length, ACE_INT32 dh_key_length, ACE_INT32 verify_depth, ACE_INT32 file_type, bool include_length, ACE_INT32 fragment_size) { this->private_key_password = private_key_password; this->private_key_file = private_key_file; this->certificate_file = certificate_file; this->random_file = random_file; this->ca_path = ca_path; this->ca_file = ca_file; this->dh_file = dh_file; this->rsa_key = rsa_key; this->dh_key = dh_key; this->rsa_key_length = rsa_key_length; this->dh_key_length = dh_key_length; this->verify_depth = verify_depth; this->file_type = file_type; this->include_length = include_length; this->fragment_size = fragment_size; } void read_config(std::string &config_file){}; //TODO: Read from a XML file all these params. std::string &get_private_key_password() {return private_key_password;}; std::string &get_private_key_file() { return private_key_file;}; std::string &get_certificate_file() {return certificate_file;}; std::string &get_random_file(){return random_file;}; std::string &get_ca_path(){return ca_path;}; std::string &get_ca_file() {return ca_file;}; std::string &get_dh_file() {return dh_file;}; ACE_INT32 get_rsa_key() {return rsa_key;}; ACE_INT32 get_dh_key() {return dh_key;}; ACE_INT32 get_rsa_key_length() {return rsa_key_length;}; ACE_INT32 get_dh_key_length() {return dh_key_length;}; ACE_INT32 get_verify_depth() {return verify_depth;}; ACE_INT32 get_file_type() {return file_type;}; bool get_include_length() {return include_length;}; ACE_INT32 get_fragment_size() {return fragment_size;}; protected: std::string private_key_password; std::string private_key_file; std::string certificate_file; std::string random_file; std::string ca_path; std::string ca_file; std::string dh_file; ACE_INT32 rsa_key; ACE_INT32 dh_key; ACE_INT32 rsa_key_length; ACE_INT32 dh_key_length; ACE_INT32 verify_depth; ACE_INT32 file_type; bool include_length; ACE_INT32 fragment_size;};/* This class gets stored in arg */class EAPTLS_tls_t{ public: EAPTLS_tls_t() {this->conf = NULL; this->ctx = NULL;}; EAPTLS_tls_t(EAPTLS_config *conf,TLS_context *ctx){this->conf = conf; this->ctx = ctx;}; virtual ~EAPTLS_tls_t() {if (conf !=NULL) delete conf; if (ctx != NULL) delete ctx;}; EAPTLS_config *get_config() {return conf;}; TLS_context *get_tls_context() {return ctx;}; protected: EAPTLS_config *conf; TLS_context *ctx;};/* * From rfc Flags 0 1 2 3 4 5 6 7 8 +-+-+-+-+-+-+-+-+ |L M S R R R R R| +-+-+-+-+-+-+-+-+ L = Length included M = More fragments S = EAP-TLS start R = Reserved The L bit (length included) is set to indicate the presence of the four octet TLS Message Length field, and MUST be set for the first fragment of a fragmented TLS message or set of messages. The M bit (more fragments) is set on all but the last fragment. The S bit (EAP-TLS start) is set in an EAP-TLS Start message. This differentiates the EAP-TLS Start message from a fragment acknowledgement. TLS Message Length The TLS Message Length field is four octets, and is present only if the L bit is set. This field provides the total length of the TLS message or set of messages that is being fragmented. TLS data The TLS data consists of the encapsulated TLS packet in TLS record format. * * The data structures present here * maps only to the typedata in the EAP packet * * Based on the L bit flag, first 4 bytes of data indicate the length *//// EAP-TLS/Request message.class EAP_TLS_EXPORTS EapRequestTls: public EapRequest{public: EapRequestTls(ACE_Byte flags) : EapRequest(EapType(TLS_METHOD_TYPE)), flags(flags) {this->data=NULL;is_ack=false;}; /// Use this function to obtain a reference to flags. ACE_Byte get_flags() { return flags; }; /// Use this function to obtain a reference to TLS message length ACE_UINT32 get_tls_message_length() { return tls_message_length;}; /// Use this function to obtain a reference to TLS message data AAAMessageBlock *get_data() {return this->data;}; bool get_is_ack(){return is_ack;}; /// Use this function to obtain a reference to flags. void set_flags(ACE_Byte flags) { this->flags=flags;}; void set_is_ack(bool is_ack) {this->is_ack = is_ack;}; /// Use this function to obtain a reference to TLS message length void set_tls_message_length(ACE_UINT32 tls_message_length) { this->tls_message_length = tls_message_length;}; /// Use this function to obtain a reference to TLS message data void set_data(AAAMessageBlock *data) { if (this->data) this->data->release(); this->data = data; };protected: bool is_ack; /// TLS Flags ACE_Byte flags; /// TLS message length ACE_UINT32 tls_message_length; /// TLS data AAAMessageBlock *data;};/// EAP-TLS/Response message.class EAP_TLS_EXPORTS EapResponseTls: public EapRequestTls{ public: EapResponseTls(ACE_Byte flags) : EapRequestTls(flags) {}};#endif // __EAP_TLS_HXX__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -