2 * FreeRDP: A Remote Desktop Protocol Client
3 * Transport Layer Security
5 * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
24 #include "certificate.h"
26 #include <openssl/ssl.h>
27 #include <openssl/err.h>
29 #include <freerdp/types.h>
30 #include <freerdp/utils/stream.h>
32 typedef struct rdp_tls rdpTls;
39 rdpSettings* settings;
40 rdpCertificateStore* certificate_store;
43 boolean tls_connect(rdpTls* tls);
44 boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_file);
45 boolean tls_disconnect(rdpTls* tls);
47 int tls_read(rdpTls* tls, uint8* data, int length);
48 int tls_write(rdpTls* tls, uint8* data, int length);
50 CryptoCert tls_get_certificate(rdpTls* tls);
51 boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname);
52 void tls_print_certificate_error(char* hostname, char* fingerprint);
53 void tls_print_certificate_name_mismatch_error(char* hostname, char* common_name, char** alt_names, int alt_names_count);
55 boolean tls_print_error(char* func, SSL* connection, int value);
57 rdpTls* tls_new(rdpSettings* settings);
58 void tls_free(rdpTls* tls);