/* Licensed to Stichting The Commons Conservancy (TCC) under one or more * contributor license agreements. See the AUTHORS file distributed with * this work for additional information regarding copyright ownership. * TCC licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #define GCR_API_SUBJECT_TO_CHANGE #include #include #include #include #ifndef SIGNTEXT_H #define SIGNTEXT_H GQuark rst_core_error_quark (void); #define RST_CORE_ERROR rst_core_error_quark () typedef enum { RST_CORE_ERROR_FAILED = 1, RST_CORE_ERROR_MISSING_ROOT, RST_CORE_ERROR_MISSING_ID, RST_CORE_ERROR_MISSING_UUID, RST_CORE_ERROR_MISSING_TITLE, RST_CORE_ERROR_MISSING_URL, RST_CORE_ERROR_URL_INVALID, RST_CORE_ERROR_MISSING_REQUEST, RST_CORE_ERROR_MISSING_CONTENT_TYPE, RST_CORE_ERROR_REQUEST_NOT_RECOGNISED, RST_CORE_ERROR_INVALID_CA, RST_CORE_ERROR_NO_MODULES, RST_CORE_ERROR_SIGN_ERROR, } SignTextCoreError; typedef struct SignTextData { GtkWidget *window; GCancellable *cancellable; GtkBox *box; GtkStackSwitcher *switcher; GtkStack *stack; GList *modules; GList *slots; GcrCollection *incoming; GcrCollection *certificates; guint modules_len; guint slots_len; guint certificates_len; guint incoming_len; guint chains_len; guint anchored_len; } SignTextData; typedef struct SignTextToken SignTextToken; struct SignTextToken { SignTextData *signtext; GckSlot *slot; GckTokenInfo *token_info; SignTextToken *next; }; typedef struct SignTextInstance { SignTextData *signtext; GUri *uri; gchar *uuid; gint64 id; gboolean detached; GList *cas; GtkStack *stack; GtkProgressBar *progress; GtkLabel *label; gchar *label_text; GtkBox *box; GtkTextBuffer *buffer; GtkTextView *textview; GcrComboSelector *selector; GtkLabel *label_agree; GtkEntryBuffer *pin_buffer; GtkEntry *pin; GtkButtonBox *buttons; GtkButton *cancel; GtkButton *sign; GcrPkcs11Certificate *certificate; GckSession *session; GckObject *key; ksba_cms_t cms; ksba_cert_t signer; const char *hash_oid; int hash_alg; gcry_md_hd_t data_md; ksba_writer_t w; ksba_stop_reason_t stopreason; guchar *payload; gsize payload_len; gint state; gint save; gboolean done; } SignTextInstance; SignTextData *signtext_data_new(); void signtext_data_free(SignTextData *data); SignTextToken *signtext_token_new(); void signtext_token_free(SignTextToken *data); SignTextInstance *signtext_instance_new(SignTextData *signtext, gint64 id, const gchar *uuid, GUri *uri); void signtext_instance_free(SignTextInstance *instance); void signtext_error(SignTextInstance *instance, GError *gerror); #endif