/* 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. */ #ifndef SIGNTEXT_H #define SIGNTEXT_H #ifdef __cplusplus extern "C" { #endif #ifndef UNICODE #define UNICODE #endif #include #include #include #include #define WM_MESSAGE_RECEIVE WM_APP+1 #define WM_MESSAGE_RECEIVED WM_APP+2 #define WM_MESSAGE_SEND WM_APP+3 #define WM_MESSAGE_SENT WM_APP+4 #define WM_MESSAGE_SHOW WM_APP+5 #define WM_CRYPTO_UPDATED WM_APP+101 #define WM_CRYPTO_SELECTED WM_APP+102 #define WM_CRYPTO_SIGNED WM_APP+103 #define WM_CRYPTO_NOTSIGNED WM_APP+104 /* From cardmod.h */ typedef enum { AlphaNumericPinType = 0, // Regular PIN ExternalPinType, // Biometric PIN ChallengeResponsePinType, // Challenge/Response PIN EmptyPinType // No PIN } SECRET_TYPE; typedef struct SignTextData { HWND hwnd; } SignTextData; typedef struct SignTextToken SignTextToken; struct SignTextToken { SignTextData* signtext; SignTextToken* next; }; typedef struct SignTextCertificate SignTextCertificate; struct SignTextCertificate { SignTextData* signtext; LPWSTR name; BYTE* pbCertEncoded; DWORD cbCertEncoded; DWORD spec; DWORD type; SECRET_TYPE secretType; SignTextCertificate* next; int ref; }; typedef struct SignTextInstance { SignTextData* signtext; char *uri; char *uuid; int id; // GList* cas; LPWSTR wUuid; size_t in_length; char* in_buffer; HWND dialogHwnd; SignTextCertificate* certificate; int pinLen; LPWSTR pinBuffer; size_t out_offset; size_t out_length; char* out_buffer; char* digestAlgorithm; int is_cancelled; int is_signing; int response_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, int id, const char* uuid, const char* uri); void signtext_instance_free(SignTextInstance* instance); SignTextCertificate* signtext_certificate_new(SignTextData* signtext, LPWSTR name, PCCERT_CONTEXT cert, DWORD spec, DWORD type, SECRET_TYPE secretType, SignTextCertificate* prev); SignTextCertificate* signtext_certificate_ref(SignTextCertificate* cert); SignTextCertificate* signtext_certificate_unref(SignTextCertificate* cert); void signtext_lasterror(); LPWSTR signtext_utf8ToUtf16(const char* buffer, size_t length); #ifdef __cplusplus } #endif #endif