summaryrefslogtreecommitdiff
path: root/glib/poppler-form-field.h
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2021-11-25 22:31:01 +0000
committerAlbert Astals Cid <tsdgeos@yahoo.es>2021-11-25 22:31:01 +0000
commit7b7b3f8018d652a0e8f38a69e28d535d98843df8 (patch)
tree0aca9136a94f835452ecc17261e88f82d50eed0b /glib/poppler-form-field.h
parent1ad64ccfa2315087ea5508d1550f816bc65fd982 (diff)
Add validation of signatures API to glib frontend
Diffstat (limited to 'glib/poppler-form-field.h')
-rw-r--r--glib/poppler-form-field.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/glib/poppler-form-field.h b/glib/poppler-form-field.h
index c895973c..b48c5064 100644
--- a/glib/poppler-form-field.h
+++ b/glib/poppler-form-field.h
@@ -1,6 +1,8 @@
/* poppler-form-field.h: glib interface to poppler
*
* Copyright (C) 2007 Carlos Garcia Campos <carlosgc@gnome.org>
+ * Copyright (C) 2021 André Guerreiro <aguerreiro1985@gmail.com>
+ * Copyright (C) 2021 Marek Kasik <mkasik@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +31,73 @@ G_BEGIN_DECLS
#define POPPLER_FORM_FIELD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), POPPLER_TYPE_FORM_FIELD, PopplerFormField))
#define POPPLER_IS_FORM_FIELD(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), POPPLER_TYPE_FORM_FIELD))
+/**
+ * PopplerSignatureStatus
+ * @POPPLER_SIGNATURE_VALID: signature is cryptographically valid
+ * @POPPLER_SIGNATURE_INVALID: signature is cryptographically invalid
+ * @POPPLER_SIGNATURE_DIGEST_MISMATCH: document content was changed after the signature was applied
+ * @POPPLER_SIGNATURE_DECODING_ERROR: signature CMS/PKCS7 structure is malformed
+ * @POPPLER_SIGNATURE_GENERIC_ERROR: failed to verify signature
+ * @POPPLER_SIGNATURE_NOT_FOUND: requested signature is not present in the document
+ * @POPPLER_SIGNATURE_NOT_VERIFIED: signature not yet verified
+ *
+ * Signature verification results
+ *
+ * Since: 21.12.0
+ */
+typedef enum
+{
+ POPPLER_SIGNATURE_VALID,
+ POPPLER_SIGNATURE_INVALID,
+ POPPLER_SIGNATURE_DIGEST_MISMATCH,
+ POPPLER_SIGNATURE_DECODING_ERROR,
+ POPPLER_SIGNATURE_GENERIC_ERROR,
+ POPPLER_SIGNATURE_NOT_FOUND,
+ POPPLER_SIGNATURE_NOT_VERIFIED
+} PopplerSignatureStatus;
+
+/**
+ * PopplerCertificateStatus
+ * @POPPLER_CERTIFICATE_TRUSTED: certificate is considered trusted
+ * @POPPLER_CERTIFICATE_UNTRUSTED_ISSUER: the issuer of this certificate has been marked as untrusted by the user
+ * @POPPLER_CERTIFICATE_UNKNOWN_ISSUER: this certificate trust chain has not finished in a trusted root certificate
+ * @POPPLER_CERTIFICATE_REVOKED: certificate was revoked by the issuing certificate authority
+ * @POPPLER_CERTIFICATE_EXPIRED: signing time is outside the validity bounds of this certificate
+ * @POPPLER_CERTIFICATE_GENERIC_ERROR: failed to verify certificate
+ * @POPPLER_CERTIFICATE_NOT_VERIFIED: certificate not yet verified
+ *
+ * Signature certificate verification results
+ *
+ * Since: 21.12.0
+ */
+typedef enum
+{
+ POPPLER_CERTIFICATE_TRUSTED,
+ POPPLER_CERTIFICATE_UNTRUSTED_ISSUER,
+ POPPLER_CERTIFICATE_UNKNOWN_ISSUER,
+ POPPLER_CERTIFICATE_REVOKED,
+ POPPLER_CERTIFICATE_EXPIRED,
+ POPPLER_CERTIFICATE_GENERIC_ERROR,
+ POPPLER_CERTIFICATE_NOT_VERIFIED
+} PopplerCertificateStatus;
+
+/**
+ * PopplerSignatureValidationFlags
+ * @POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE: Whether to validate also the certificate of the signature
+ * @POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK: Whether to not do OCSP (Online Certificate Status Protocol) revocation check
+ * @POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH: Whether to use AIA (Authority Information Access) extension for certificate fetching
+ *
+ * Signature validation flags
+ *
+ * Since: 21.12.0
+ */
+typedef enum /*< flags >*/
+{
+ POPPLER_SIGNATURE_VALIDATION_FLAG_VALIDATE_CERTIFICATE = 1 << 0,
+ POPPLER_SIGNATURE_VALIDATION_FLAG_WITHOUT_OCSP_REVOCATION_CHECK = 1 << 1,
+ POPPLER_SIGNATURE_VALIDATION_FLAG_USE_AIA_CERTIFICATE_FETCH = 1 << 2,
+} PopplerSignatureValidationFlags;
+
typedef enum
{
POPPLER_FORM_FIELD_UNKNOWN,
@@ -156,6 +225,29 @@ POPPLER_PUBLIC
void poppler_form_field_choice_set_text(PopplerFormField *field, const gchar *text);
POPPLER_PUBLIC
gchar *poppler_form_field_choice_get_text(PopplerFormField *field);
+POPPLER_PUBLIC
+PopplerSignatureInfo *poppler_form_field_signature_validate_sync(PopplerFormField *field, PopplerSignatureValidationFlags flags, GCancellable *cancellable, GError **error);
+POPPLER_PUBLIC
+void poppler_form_field_signature_validate_async(PopplerFormField *field, PopplerSignatureValidationFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data);
+POPPLER_PUBLIC
+PopplerSignatureInfo *poppler_form_field_signature_validate_finish(PopplerFormField *field, GAsyncResult *result, GError **error);
+
+/* Signature Field */
+#define POPPLER_TYPE_SIGNATURE_INFO (poppler_signature_info_get_type())
+POPPLER_PUBLIC
+GType poppler_signature_info_get_type(void) G_GNUC_CONST;
+POPPLER_PUBLIC
+PopplerSignatureInfo *poppler_signature_info_copy(const PopplerSignatureInfo *siginfo);
+POPPLER_PUBLIC
+void poppler_signature_info_free(PopplerSignatureInfo *siginfo);
+POPPLER_PUBLIC
+PopplerSignatureStatus poppler_signature_info_get_signature_status(const PopplerSignatureInfo *siginfo);
+POPPLER_PUBLIC
+PopplerCertificateStatus poppler_signature_info_get_certificate_status(const PopplerSignatureInfo *siginfo);
+POPPLER_PUBLIC
+const gchar *poppler_signature_info_get_signer_name(const PopplerSignatureInfo *siginfo);
+POPPLER_PUBLIC
+GDateTime *poppler_signature_info_get_local_signing_time(const PopplerSignatureInfo *siginfo);
G_END_DECLS