File: WebKitCertificateInfo.cpp

package info (click to toggle)
webkitgtk 2.4.9-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 120,620 kB
  • ctags: 192,221
  • sloc: cpp: 1,034,319; ansic: 19,255; sh: 11,153; perl: 10,747; ruby: 8,592; asm: 4,378; python: 4,132; yacc: 2,072; lex: 350; makefile: 215; xml: 63
file content (120 lines) | stat: -rw-r--r-- 3,541 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * Copyright (C) 2013 Samsung Electronics Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#include "config.h"
#include "WebKitCertificateInfo.h"

#include "WebKitCertificateInfoPrivate.h"
#include <wtf/text/CString.h>

using namespace WebKit;
using namespace WebCore;

/**
 * SECTION: WebKitCertificateInfo
 * @Short_description: Boxed type to encapsulate TLS certificate information
 * @Title: WebKitCertificateInfo
 * @See_also: #WebKitWebView, #WebKitWebContext
 *
 * When a client loads a page over HTTPS where there is an underlying TLS error
 * WebKit will fire a #WebKitWebView::load-failed-with-tls-errors signal with a
 * #WebKitCertificateInfo and the host of the failing URI.
 *
 * To handle this signal asynchronously you should make a copy of the
 * #WebKitCertificateInfo with webkit_certificate_info_copy().
 */

G_DEFINE_BOXED_TYPE(WebKitCertificateInfo, webkit_certificate_info, webkit_certificate_info_copy, webkit_certificate_info_free)

const CertificateInfo& webkitCertificateInfoGetCertificateInfo(WebKitCertificateInfo* info)
{
    ASSERT(info);
    return info->certificateInfo;
}

/**
 * webkit_certificate_info_copy:
 * @info: a #WebKitCertificateInfo
 *
 * Make a copy of the #WebKitCertificateInfo.
 *
 * Returns: (transfer full): A copy of passed in #WebKitCertificateInfo.
 *
 * Since: 2.4
 */
WebKitCertificateInfo* webkit_certificate_info_copy(WebKitCertificateInfo* info)
{
    g_return_val_if_fail(info, 0);

    WebKitCertificateInfo* copy = g_slice_new0(WebKitCertificateInfo);
    new (copy) WebKitCertificateInfo(info);
    return copy;
}

/**
 * webkit_certificate_info_free:
 * @info: a #WebKitCertificateInfo
 *
 * Free the #WebKitCertificateInfo.
 *
 * Since: 2.4
 */
void webkit_certificate_info_free(WebKitCertificateInfo* info)
{
    g_return_if_fail(info);

    info->~WebKitCertificateInfo();
    g_slice_free(WebKitCertificateInfo, info);
}

/**
 * webkit_certificate_info_get_tls_certificate:
 * @info: a #WebKitCertificateInfo
 *
 * Get the #GTlsCertificate associated with this
 * #WebKitCertificateInfo.
 *
 * Returns: (transfer none): The certificate of @info.
 *
 * Since: 2.4
 */
GTlsCertificate* webkit_certificate_info_get_tls_certificate(WebKitCertificateInfo *info)
{
    g_return_val_if_fail(info, 0);

    return info->certificateInfo.certificate();
}

/**
 * webkit_certificate_info_get_tls_errors:
 * @info: a #WebKitCertificateInfo
 *
 * Get the #GTlsCertificateFlags verification status associated with this
 * #WebKitCertificateInfo.
 *
 * Returns: The verification status of @info.
 *
 * Since: 2.4
 */
GTlsCertificateFlags webkit_certificate_info_get_tls_errors(WebKitCertificateInfo *info)
{
    g_return_val_if_fail(info, static_cast<GTlsCertificateFlags>(0));

    return info->certificateInfo.tlsErrors();
}