Title: [279404] trunk/Source/WebCore
- Revision
- 279404
- Author
- [email protected]
- Date
- 2021-06-30 00:56:11 -0700 (Wed, 30 Jun 2021)
Log Message
[SOUP] Implement CertificateInfo::summary
https://bugs.webkit.org/show_bug.cgi?id=227484
Reviewed by Michael Catanzaro.
GLib now provides API to get the information required to fill the CertificateSummary.
* platform/network/soup/CertificateInfo.h:
(WebCore::CertificateInfo::summary const): Deleted.
* platform/network/soup/CertificateInfoSoup.cpp:
(WebCore::CertificateInfo::summary const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (279403 => 279404)
--- trunk/Source/WebCore/ChangeLog 2021-06-30 07:50:30 UTC (rev 279403)
+++ trunk/Source/WebCore/ChangeLog 2021-06-30 07:56:11 UTC (rev 279404)
@@ -1,3 +1,17 @@
+2021-06-30 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] Implement CertificateInfo::summary
+ https://bugs.webkit.org/show_bug.cgi?id=227484
+
+ Reviewed by Michael Catanzaro.
+
+ GLib now provides API to get the information required to fill the CertificateSummary.
+
+ * platform/network/soup/CertificateInfo.h:
+ (WebCore::CertificateInfo::summary const): Deleted.
+ * platform/network/soup/CertificateInfoSoup.cpp:
+ (WebCore::CertificateInfo::summary const):
+
2021-06-29 Tim Nguyen <[email protected]>
Implement form[method=dialog]
Modified: trunk/Source/WebCore/platform/network/soup/CertificateInfo.h (279403 => 279404)
--- trunk/Source/WebCore/platform/network/soup/CertificateInfo.h 2021-06-30 07:50:30 UTC (rev 279403)
+++ trunk/Source/WebCore/platform/network/soup/CertificateInfo.h 2021-06-30 07:56:11 UTC (rev 279404)
@@ -57,7 +57,7 @@
bool containsNonRootSHA1SignedCertificate() const { notImplemented(); return false; }
- std::optional<CertificateSummary> summary() const { notImplemented(); return std::nullopt; }
+ std::optional<CertificateSummary> summary() const;
bool isEmpty() const { return !m_certificate; }
Modified: trunk/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp (279403 => 279404)
--- trunk/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp 2021-06-30 07:50:30 UTC (rev 279403)
+++ trunk/Source/WebCore/platform/network/soup/CertificateInfoSoup.cpp 2021-06-30 07:56:11 UTC (rev 279404)
@@ -103,6 +103,49 @@
return CertificateInfo(copy.get(), m_tlsErrors);
}
+std::optional<CertificateSummary> CertificateInfo::summary() const
+{
+ if (!m_certificate)
+ return std::nullopt;
+
+#if GLIB_CHECK_VERSION(2, 69, 0)
+ CertificateSummary summaryInfo;
+
+ GRefPtr<GDateTime> validNotBefore;
+ GRefPtr<GDateTime> validNotAfter;
+ GUniqueOutPtr<char> subjectName;
+ GRefPtr<GPtrArray> dnsNames;
+ GRefPtr<GPtrArray> ipAddresses;
+ g_object_get(m_certificate.get(), "not-valid-before", &validNotBefore.outPtr(), "not-valid-after", &validNotAfter.outPtr(),
+ "subject-name", &subjectName.outPtr(), "dns-names", &dnsNames.outPtr(), "ip-addresses", &ipAddresses.outPtr(), nullptr);
+
+ if (validNotBefore)
+ summaryInfo.validFrom = Seconds(static_cast<double>(g_date_time_to_unix(validNotBefore.get())));
+ if (validNotAfter)
+ summaryInfo.validUntil = Seconds(static_cast<double>(g_date_time_to_unix(validNotAfter.get())));
+ if (subjectName)
+ summaryInfo.subject = String::fromUTF8(subjectName.get());
+ if (dnsNames) {
+ for (unsigned i = 0; i < dnsNames->len; ++i) {
+ GBytes* bytes = static_cast<GBytes*>(dnsNames->pdata[i]);
+ gsize dataLength;
+ const auto* data = "" &dataLength);
+ summaryInfo.dnsNames.append(String(static_cast<const char*>(data), dataLength));
+ }
+ }
+ if (ipAddresses) {
+ for (unsigned i = 0; i < ipAddresses->len; ++i) {
+ GUniquePtr<char> ipAddress(g_inet_address_to_string(static_cast<GInetAddress*>(ipAddresses->pdata[i])));
+ summaryInfo.ipAddresses.append(String::fromUTF8(ipAddress.get()));
+ }
+ }
+
+ return summaryInfo;
+#else
+ return std::nullopt;
+#endif
+}
+
} // namespace WebCore
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes