1221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* crypto/ts/ts.h */ 2221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL 3221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * project 2002, 2003, 2004. 4221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 5221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* ==================================================================== 6221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Copyright (c) 2006 The OpenSSL Project. All rights reserved. 7221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 8221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Redistribution and use in source and binary forms, with or without 9221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * modification, are permitted provided that the following conditions 10221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * are met: 11221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 12221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 1. Redistributions of source code must retain the above copyright 13221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * notice, this list of conditions and the following disclaimer. 14221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 15221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 2. Redistributions in binary form must reproduce the above copyright 16221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * notice, this list of conditions and the following disclaimer in 17221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * the documentation and/or other materials provided with the 18221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * distribution. 19221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 20221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 3. All advertising materials mentioning features or use of this 21221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * software must display the following acknowledgment: 22221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * "This product includes software developed by the OpenSSL Project 23221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" 24221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 25221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 26221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * endorse or promote products derived from this software without 27221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * prior written permission. For written permission, please contact 28221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * licensing@OpenSSL.org. 29221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 30221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 5. Products derived from this software may not be called "OpenSSL" 31221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * nor may "OpenSSL" appear in their names without prior written 32221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * permission of the OpenSSL Project. 33221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 34221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 6. Redistributions of any form whatsoever must retain the following 35221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * acknowledgment: 36221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * "This product includes software developed by the OpenSSL Project 37221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" 38221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 39221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 40221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 41221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 42221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 43221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 45221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 46221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 48221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 49221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 50221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * OF THE POSSIBILITY OF SUCH DAMAGE. 51221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * ==================================================================== 52221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 53221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * This product includes cryptographic software written by Eric Young 54221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * (eay@cryptsoft.com). This product includes software written by Tim 55221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Hudson (tjh@cryptsoft.com). 56221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * 57221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 58221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 59221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef HEADER_TS_H 60221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define HEADER_TS_H 61221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 62221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/opensslconf.h> 63221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/symhacks.h> 64221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_BUFFER 65221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/buffer.h> 66221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 67221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_EVP 68221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/evp.h> 69221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 70221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_BIO 71221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/bio.h> 72221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 73221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/stack.h> 74221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/asn1.h> 75221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/safestack.h> 76221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 77221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_RSA 78221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/rsa.h> 79221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 80221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 81221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_DSA 82221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/dsa.h> 83221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 84221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 85221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_DH 86221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/dh.h> 87221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 88221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 89221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifdef __cplusplus 90221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromextern "C" { 91221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 92221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 93221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifdef WIN32 94221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Under Win32 this is defined in wincrypt.h */ 95221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#undef X509_NAME 96221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 97221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 98221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/x509.h> 99221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/x509v3.h> 100221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 101221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 102221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromMessageImprint ::= SEQUENCE { 103221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom hashAlgorithm AlgorithmIdentifier, 104221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom hashedMessage OCTET STRING } 105221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 106221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 107221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_msg_imprint_st 108221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 109221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom X509_ALGOR *hash_algo; 110221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_OCTET_STRING *hashed_msg; 111221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_MSG_IMPRINT; 112221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 113221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 114221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTimeStampReq ::= SEQUENCE { 115221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom version INTEGER { v1(1) }, 116221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom messageImprint MessageImprint, 117221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom --a hash algorithm OID and the hash value of the data to be 118221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom --time-stamped 119221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom reqPolicy TSAPolicyId OPTIONAL, 120221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom nonce INTEGER OPTIONAL, 121221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom certReq BOOLEAN DEFAULT FALSE, 122221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom extensions [0] IMPLICIT Extensions OPTIONAL } 123221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 124221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 125221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_req_st 126221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 127221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *version; 128221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_MSG_IMPRINT *msg_imprint; 129221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_OBJECT *policy_id; /* OPTIONAL */ 130221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *nonce; /* OPTIONAL */ 131221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_BOOLEAN cert_req; /* DEFAULT FALSE */ 132221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(X509_EXTENSION) *extensions; /* [0] OPTIONAL */ 133221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_REQ; 134221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 135221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 136221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromAccuracy ::= SEQUENCE { 137221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom seconds INTEGER OPTIONAL, 138221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom millis [0] INTEGER (1..999) OPTIONAL, 139221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom micros [1] INTEGER (1..999) OPTIONAL } 140221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 141221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 142221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_accuracy_st 143221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 144221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *seconds; 145221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *millis; 146221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *micros; 147221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_ACCURACY; 148221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 149221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 150221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTSTInfo ::= SEQUENCE { 151221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom version INTEGER { v1(1) }, 152221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom policy TSAPolicyId, 153221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom messageImprint MessageImprint, 154221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- MUST have the same value as the similar field in 155221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- TimeStampReq 156221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom serialNumber INTEGER, 157221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- Time-Stamping users MUST be ready to accommodate integers 158221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- up to 160 bits. 159221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom genTime GeneralizedTime, 160221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom accuracy Accuracy OPTIONAL, 161221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ordering BOOLEAN DEFAULT FALSE, 162221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom nonce INTEGER OPTIONAL, 163221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- MUST be present if the similar field was present 164221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- in TimeStampReq. In that case it MUST have the same value. 165221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom tsa [0] GeneralName OPTIONAL, 166221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom extensions [1] IMPLICIT Extensions OPTIONAL } 167221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 168221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 169221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_tst_info_st 170221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 171221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *version; 172221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_OBJECT *policy_id; 173221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_MSG_IMPRINT *msg_imprint; 174221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *serial; 175221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_GENERALIZEDTIME *time; 176221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_ACCURACY *accuracy; 177221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_BOOLEAN ordering; 178221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *nonce; 179221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom GENERAL_NAME *tsa; 180221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(X509_EXTENSION) *extensions; 181221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_TST_INFO; 182221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 183221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 184221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromPKIStatusInfo ::= SEQUENCE { 185221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom status PKIStatus, 186221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom statusString PKIFreeText OPTIONAL, 187221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom failInfo PKIFailureInfo OPTIONAL } 188221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 189221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromFrom RFC 1510 - section 3.1.1: 190221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromPKIFreeText ::= SEQUENCE SIZE (1..MAX) OF UTF8String 191221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- text encoded as UTF-8 String (note: each UTF8String SHOULD 192221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- include an RFC 1766 language tag to indicate the language 193221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom -- of the contained text) 194221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 195221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 196221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Possible values for status. See ts_resp_print.c && ts_resp_verify.c. */ 197221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 198221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_STATUS_GRANTED 0 199221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_STATUS_GRANTED_WITH_MODS 1 200221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_STATUS_REJECTION 2 201221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_STATUS_WAITING 3 202221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_STATUS_REVOCATION_WARNING 4 203221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_STATUS_REVOCATION_NOTIFICATION 5 204221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 205221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Possible values for failure_info. See ts_resp_print.c && ts_resp_verify.c */ 206221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 207221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_BAD_ALG 0 208221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_BAD_REQUEST 2 209221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_BAD_DATA_FORMAT 5 210221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_TIME_NOT_AVAILABLE 14 211221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_UNACCEPTED_POLICY 15 212221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_UNACCEPTED_EXTENSION 16 213221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_ADD_INFO_NOT_AVAILABLE 17 214221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_INFO_SYSTEM_FAILURE 25 215221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 216221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_status_info_st 217221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 218221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *status; 219221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(ASN1_UTF8STRING) *text; 220221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_BIT_STRING *failure_info; 221221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_STATUS_INFO; 222221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 223221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromDECLARE_STACK_OF(ASN1_UTF8STRING) 224221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromDECLARE_ASN1_SET_OF(ASN1_UTF8STRING) 225221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 226221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 227221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTimeStampResp ::= SEQUENCE { 228221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom status PKIStatusInfo, 229221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom timeStampToken TimeStampToken OPTIONAL } 230221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 231221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 232221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_resp_st 233221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 234221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_STATUS_INFO *status_info; 235221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom PKCS7 *token; 236221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_TST_INFO *tst_info; 237221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_RESP; 238221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 239221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* The structure below would belong to the ESS component. */ 240221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 241221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 242221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromIssuerSerial ::= SEQUENCE { 243221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom issuer GeneralNames, 244221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom serialNumber CertificateSerialNumber 245221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } 246221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 247221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 248221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct ESS_issuer_serial 249221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 250221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(GENERAL_NAME) *issuer; 251221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *serial; 252221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } ESS_ISSUER_SERIAL; 253221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 254221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 255221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESSCertID ::= SEQUENCE { 256221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom certHash Hash, 257221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom issuerSerial IssuerSerial OPTIONAL 258221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom} 259221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 260221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 261221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct ESS_cert_id 262221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 263221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_OCTET_STRING *hash; /* Always SHA-1 digest. */ 264221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ESS_ISSUER_SERIAL *issuer_serial; 265221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } ESS_CERT_ID; 266221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 267221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromDECLARE_STACK_OF(ESS_CERT_ID) 268221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromDECLARE_ASN1_SET_OF(ESS_CERT_ID) 269221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 270221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 271221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromSigningCertificate ::= SEQUENCE { 272221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom certs SEQUENCE OF ESSCertID, 273221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom policies SEQUENCE OF PolicyInformation OPTIONAL 274221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom} 275221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom*/ 276221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 277221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct ESS_signing_cert 278221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 279221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(ESS_CERT_ID) *cert_ids; 280221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(POLICYINFO) *policy_info; 281221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } ESS_SIGNING_CERT; 282221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 283221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 284221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_REQ *TS_REQ_new(void); 285221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_REQ_free(TS_REQ *a); 286221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_REQ(const TS_REQ *a, unsigned char **pp); 287221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); 288221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 289221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_REQ *TS_REQ_dup(TS_REQ *a); 290221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 291221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); 292221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); 293221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); 294221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); 295221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 296221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void); 297221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a); 298221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp); 299221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, 300221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const unsigned char **pp, long length); 301221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 302221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); 303221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 304221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); 305221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); 306221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a); 307221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a); 308221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 309221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP *TS_RESP_new(void); 310221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_free(TS_RESP *a); 311221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_RESP(const TS_RESP *a, unsigned char **pp); 312221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); 313221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); 314221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP *TS_RESP_dup(TS_RESP *a); 315221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 316221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); 317221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); 318221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a); 319221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_RESP_bio(BIO *fp, TS_RESP *a); 320221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 321221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_STATUS_INFO *TS_STATUS_INFO_new(void); 322221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_STATUS_INFO_free(TS_STATUS_INFO *a); 323221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp); 324221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a, 325221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const unsigned char **pp, long length); 326221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a); 327221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 328221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *TS_TST_INFO_new(void); 329221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_TST_INFO_free(TS_TST_INFO *a); 330221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp); 331221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, 332221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom long length); 333221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); 334221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 335221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); 336221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); 337221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a); 338221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a); 339221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 340221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_ACCURACY *TS_ACCURACY_new(void); 341221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_ACCURACY_free(TS_ACCURACY *a); 342221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp); 343221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp, 344221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom long length); 345221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a); 346221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 347221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void); 348221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a); 349221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, 350221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned char **pp); 351221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a, 352221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const unsigned char **pp, long length); 353221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a); 354221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 355221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_CERT_ID *ESS_CERT_ID_new(void); 356221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ESS_CERT_ID_free(ESS_CERT_ID *a); 357221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp); 358221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp, 359221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom long length); 360221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a); 361221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 362221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void); 363221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a); 364221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, 365221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned char **pp); 366221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a, 367221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const unsigned char **pp, long length); 368221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a); 369221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 370221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ERR_load_TS_strings(void); 371221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 372221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_set_version(TS_REQ *a, long version); 373221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromlong TS_REQ_get_version(const TS_REQ *a); 374221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 375221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint); 376221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a); 377221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 378221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg); 379221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromX509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a); 380221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 381221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len); 382221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a); 383221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 384221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_set_policy_id(TS_REQ *a, ASN1_OBJECT *policy); 385221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a); 386221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 387221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce); 388221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a); 389221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 390221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_set_cert_req(TS_REQ *a, int cert_req); 391221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_get_cert_req(const TS_REQ *a); 392221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 393221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromSTACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a); 394221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_REQ_ext_free(TS_REQ *a); 395221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_get_ext_count(TS_REQ *a); 396221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos); 397221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_get_ext_by_OBJ(TS_REQ *a, ASN1_OBJECT *obj, int lastpos); 398221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos); 399221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromX509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc); 400221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromX509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc); 401221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc); 402221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx); 403221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 404221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Function declarations for TS_REQ defined in ts/ts_req_print.c */ 405221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 406221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_REQ_print_bio(BIO *bio, TS_REQ *a); 407221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 408221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */ 409221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 410221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info); 411221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a); 412221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 413221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */ 414221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info); 415221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromPKCS7 *TS_RESP_get_token(TS_RESP *a); 416221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a); 417221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 418221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_version(TS_TST_INFO *a, long version); 419221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromlong TS_TST_INFO_get_version(const TS_TST_INFO *a); 420221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 421221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id); 422221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a); 423221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 424221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint); 425221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a); 426221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 427221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial); 428221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a); 429221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 430221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime); 431221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a); 432221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 433221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy); 434221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a); 435221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 436221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds); 437221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a); 438221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 439221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis); 440221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a); 441221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 442221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros); 443221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a); 444221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 445221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering); 446221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_get_ordering(const TS_TST_INFO *a); 447221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 448221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce); 449221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a); 450221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 451221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa); 452221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromGENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a); 453221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 454221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromSTACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a); 455221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_TST_INFO_ext_free(TS_TST_INFO *a); 456221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_get_ext_count(TS_TST_INFO *a); 457221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos); 458221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, ASN1_OBJECT *obj, int lastpos); 459221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos); 460221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromX509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc); 461221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromX509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc); 462221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc); 463221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx); 464221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 465221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Declarations related to response generation, defined in ts/ts_resp_sign.c. */ 466221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 467221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Optional flags for response generation. */ 468221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 469221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Don't include the TSA name in response. */ 470221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_TSA_NAME 0x01 471221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 472221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Set ordering to true in response. */ 473221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_ORDERING 0x02 474221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 475221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 476221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Include the signer certificate and the other specified certificates in 477221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * the ESS signing certificate attribute beside the PKCS7 signed data. 478221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Only the signer certificates is included by default. 479221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 480221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_ESS_CERT_ID_CHAIN 0x04 481221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 482221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Forward declaration. */ 483221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromstruct TS_resp_ctx; 484221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 485221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* This must return a unique number less than 160 bits long. */ 486221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef ASN1_INTEGER *(*TS_serial_cb)(struct TS_resp_ctx *, void *); 487221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 488221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* This must return the seconds and microseconds since Jan 1, 1970 in 489221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom the sec and usec variables allocated by the caller. 490221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom Return non-zero for success and zero for failure. */ 491221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef int (*TS_time_cb)(struct TS_resp_ctx *, void *, long *sec, long *usec); 492221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 493221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* This must process the given extension. 494221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * It can modify the TS_TST_INFO object of the context. 495221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Return values: !0 (processed), 0 (error, it must set the 496221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * status info/failure info of the response). 497221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 498221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef int (*TS_extension_cb)(struct TS_resp_ctx *, X509_EXTENSION *, void *); 499221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 500221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_resp_ctx 501221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 502221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom X509 *signer_cert; 503221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom EVP_PKEY *signer_key; 504221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(X509) *certs; /* Certs to include in signed data. */ 505221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(ASN1_OBJECT) *policies; /* Acceptable policies. */ 506221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_OBJECT *default_policy; /* It may appear in policies, too. */ 507221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(EVP_MD) *mds; /* Acceptable message digests. */ 508221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *seconds; /* accuracy, 0 means not specified. */ 509221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *millis; /* accuracy, 0 means not specified. */ 510221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *micros; /* accuracy, 0 means not specified. */ 511221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned clock_precision_digits; /* fraction of seconds in 512221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom time stamp token. */ 513221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned flags; /* Optional info, see values above. */ 514221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 515221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Callback functions. */ 516221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_serial_cb serial_cb; 517221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom void *serial_cb_data; /* User data for serial_cb. */ 518221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 519221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_time_cb time_cb; 520221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom void *time_cb_data; /* User data for time_cb. */ 521221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 522221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_extension_cb extension_cb; 523221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom void *extension_cb_data; /* User data for extension_cb. */ 524221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 525221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* These members are used only while creating the response. */ 526221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_REQ *request; 527221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_RESP *response; 528221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_TST_INFO *tst_info; 529221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_RESP_CTX; 530221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 531221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromDECLARE_STACK_OF(EVP_MD) 532221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromDECLARE_ASN1_SET_OF(EVP_MD) 533221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 534221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Creates a response context that can be used for generating responses. */ 535221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP_CTX *TS_RESP_CTX_new(void); 536221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_CTX_free(TS_RESP_CTX *ctx); 537221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 538221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* This parameter must be set. */ 539221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer); 540221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 541221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* This parameter must be set. */ 542221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key); 543221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 544221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* This parameter must be set. */ 545221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *def_policy); 546221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 547221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* No additional certs are included in the response by default. */ 548221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs); 549221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 550221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Adds a new acceptable policy, only the default policy 551221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom is accepted by default. */ 552221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, ASN1_OBJECT *policy); 553221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 554221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Adds a new acceptable message digest. Note that no message digests 555221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom are accepted by default. The md argument is shared with the caller. */ 556221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md); 557221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 558221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Accuracy is not included by default. */ 559221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx, 560221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom int secs, int millis, int micros); 561221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 562221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Clock precision digits, i.e. the number of decimal digits: 563221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom '0' means sec, '3' msec, '6' usec, and so on. Default is 0. */ 564221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx, 565221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned clock_precision_digits); 566221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* At most we accept usec precision. */ 567221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_MAX_CLOCK_PRECISION_DIGITS 6 568221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 569221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* No flags are set by default. */ 570221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags); 571221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 572221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Default callback always returns a constant. */ 573221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data); 574221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 575221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Default callback uses the gettimeofday() and gmtime() system calls. */ 576221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data); 577221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 578221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Default callback rejects all extensions. The extension callback is called 579221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * when the TS_TST_INFO object is already set up and not signed yet. */ 580221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* FIXME: extension handling is not tested yet. */ 581221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx, 582221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_extension_cb cb, void *data); 583221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 584221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* The following methods can be used in the callbacks. */ 585221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx, 586221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom int status, const char *text); 587221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 588221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Sets the status info only if it is still TS_STATUS_GRANTED. */ 589221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx, 590221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom int status, const char *text); 591221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 592221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure); 593221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 594221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* The get methods below can be used in the extension callback. */ 595221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx); 596221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 597221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx); 598221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 599221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 600221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Creates the signed TS_TST_INFO and puts it in TS_RESP. 601221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * In case of errors it sets the status info properly. 602221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Returns NULL only in case of memory allocation/fatal error. 603221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 604221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio); 605221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 606221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 607221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Declarations related to response verification, 608221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * they are defined in ts/ts_resp_verify.c. 609221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 610221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 611221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs, 612221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom X509_STORE *store, X509 **signer_out); 613221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 614221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Context structure for the generic verify method. */ 615221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 616221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify the signer's certificate and the signature of the response. */ 617221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_SIGNATURE (1u << 0) 618221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify the version number of the response. */ 619221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_VERSION (1u << 1) 620221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify if the policy supplied by the user matches the policy of the TSA. */ 621221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_POLICY (1u << 2) 622221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify the message imprint provided by the user. This flag should not be 623221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom specified with TS_VFY_DATA. */ 624221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_IMPRINT (1u << 3) 625221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify the message imprint computed by the verify method from the user 626221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom provided data and the MD algorithm of the response. This flag should not be 627221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom specified with TS_VFY_IMPRINT. */ 628221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_DATA (1u << 4) 629221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify the nonce value. */ 630221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_NONCE (1u << 5) 631221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify if the TSA name field matches the signer certificate. */ 632221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_SIGNER (1u << 6) 633221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Verify if the TSA name field equals to the user provided name. */ 634221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_TSA_NAME (1u << 7) 635221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 636221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* You can use the following convenience constants. */ 637221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \ 638221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_VERSION \ 639221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_POLICY \ 640221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_IMPRINT \ 641221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_NONCE \ 642221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_SIGNER \ 643221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_TSA_NAME) 644221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \ 645221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_VERSION \ 646221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_POLICY \ 647221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_DATA \ 648221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_NONCE \ 649221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_SIGNER \ 650221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom | TS_VFY_TSA_NAME) 651221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 652221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromtypedef struct TS_verify_ctx 653221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom { 654221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Set this to the union of TS_VFY_... flags you want to carry out. */ 655221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned flags; 656221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 657221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Must be set only with TS_VFY_SIGNATURE. certs is optional. */ 658221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom X509_STORE *store; 659221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom STACK_OF(X509) *certs; 660221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 661221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Must be set only with TS_VFY_POLICY. */ 662221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_OBJECT *policy; 663221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 664221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Must be set only with TS_VFY_IMPRINT. If md_alg is NULL, 665221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom the algorithm from the response is used. */ 666221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom X509_ALGOR *md_alg; 667221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned char *imprint; 668221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom unsigned imprint_len; 669221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 670221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Must be set only with TS_VFY_DATA. */ 671221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom BIO *data; 672221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 673221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Must be set only with TS_VFY_TSA_NAME. */ 674221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom ASN1_INTEGER *nonce; 675221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 676221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom /* Must be set only with TS_VFY_TSA_NAME. */ 677221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom GENERAL_NAME *tsa_name; 678221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom } TS_VERIFY_CTX; 679221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 680221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response); 681221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token); 682221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 683221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 684221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Declarations related to response verification context, 685221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * they are defined in ts/ts_verify_ctx.c. 686221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 687221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 688221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Set all fields to zero. */ 689221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_VERIFY_CTX *TS_VERIFY_CTX_new(void); 690221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx); 691221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx); 692221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx); 693221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 694221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* 695221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * If ctx is NULL, it allocates and returns a new object, otherwise 696221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * it returns ctx. It initialises all the members as follows: 697221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE) 698221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * certs = NULL 699221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * store = NULL 700221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * policy = policy from the request or NULL if absent (in this case 701221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * TS_VFY_POLICY is cleared from flags as well) 702221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * md_alg = MD algorithm from request 703221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * imprint, imprint_len = imprint from request 704221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * data = NULL 705221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * nonce, nonce_len = nonce from the request or NULL if absent (in this case 706221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * TS_VFY_NONCE is cleared from flags as well) 707221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * tsa_name = NULL 708221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * Important: after calling this method TS_VFY_SIGNATURE should be added! 709221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 710221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromTS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx); 711221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 712221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */ 713221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 714221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_RESP_print_bio(BIO *bio, TS_RESP *a); 715221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a); 716221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a); 717221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 718221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Common utility functions defined in ts/ts_lib.c */ 719221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 720221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num); 721221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj); 722221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions); 723221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg); 724221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); 725221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 726221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Function declarations for handling configuration options, 727221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom defined in ts/ts_conf.c */ 728221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 729221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromX509 *TS_CONF_load_cert(const char *file); 730221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromSTACK_OF(X509) *TS_CONF_load_certs(const char *file); 731221304ee937bc0910948a8be1320cb8cc4eb6d36Brian CarlstromEVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); 732221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst char *TS_CONF_get_tsa_section(CONF *conf, const char *section); 733221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, 734221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_RESP_CTX *ctx); 735221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_crypto_device(CONF *conf, const char *section, 736221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const char *device); 737221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_default_engine(const char *name); 738221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_signer_cert(CONF *conf, const char *section, 739221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const char *cert, TS_RESP_CTX *ctx); 740221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, 741221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_RESP_CTX *ctx); 742221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_signer_key(CONF *conf, const char *section, 743221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const char *key, const char *pass, TS_RESP_CTX *ctx); 744221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_def_policy(CONF *conf, const char *section, 745221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom const char *policy, TS_RESP_CTX *ctx); 746221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); 747221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx); 748221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx); 749221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_clock_precision_digits(CONF *conf, const char *section, 750221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_RESP_CTX *ctx); 751221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx); 752221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx); 753221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromint TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section, 754221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom TS_RESP_CTX *ctx); 755221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 756221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* -------------------------------------------------- */ 757221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* BEGIN ERROR CODES */ 758221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* The following lines are auto generated by the script mkerr.pl. Any changes 759221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom * made after this point may be overwritten when the script is next run. 760221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom */ 761221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromvoid ERR_load_TS_strings(void); 762221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 763221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Error codes for the TS functions. */ 764221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 765221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Function codes. */ 766221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_D2I_TS_RESP 147 767221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_DEF_SERIAL_CB 110 768221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_DEF_TIME_CB 111 769221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_ESS_ADD_SIGNING_CERT 112 770221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_ESS_CERT_ID_NEW_INIT 113 771221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_ESS_SIGNING_CERT_NEW_INIT 114 772221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_INT_TS_RESP_VERIFY_TOKEN 149 773221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_PKCS7_TO_TS_TST_INFO 148 774221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_ACCURACY_SET_MICROS 115 775221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_ACCURACY_SET_MILLIS 116 776221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_ACCURACY_SET_SECONDS 117 777221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_CHECK_IMPRINTS 100 778221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_CHECK_NONCES 101 779221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_CHECK_POLICY 102 780221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_CHECK_SIGNING_CERTS 103 781221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_CHECK_STATUS_INFO 104 782221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_COMPUTE_IMPRINT 145 783221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 784221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_GET_STATUS_TEXT 105 785221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 786221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_REQ_SET_MSG_IMPRINT 119 787221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_REQ_SET_NONCE 120 788221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_REQ_SET_POLICY_ID 121 789221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CREATE_RESPONSE 122 790221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CREATE_TST_INFO 123 791221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124 792221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_ADD_MD 125 793221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_ADD_POLICY 126 794221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_NEW 127 795221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_SET_ACCURACY 128 796221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_SET_CERTS 129 797221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130 798221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131 799221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132 800221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_GET_POLICY 133 801221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134 802221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_SET_STATUS_INFO 135 803221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_SET_TST_INFO 150 804221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_SIGN 136 805221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_VERIFY_SIGNATURE 106 806221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_RESP_VERIFY_TOKEN 107 807221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_ACCURACY 137 808221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138 809221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_NONCE 139 810221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_POLICY_ID 140 811221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_SERIAL 141 812221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_TIME 142 813221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_TST_INFO_SET_TSA 143 814221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_VERIFY 108 815221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_VERIFY_CERT 109 816221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_F_TS_VERIFY_CTX_NEW 144 817221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 818221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* Reason codes. */ 819221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_BAD_PKCS7_TYPE 132 820221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_BAD_TYPE 133 821221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_CERTIFICATE_VERIFY_ERROR 100 822221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_COULD_NOT_SET_ENGINE 127 823221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_COULD_NOT_SET_TIME 115 824221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_D2I_TS_RESP_INT_FAILED 128 825221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_DETACHED_CONTENT 134 826221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116 827221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101 828221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_INVALID_NULL_POINTER 102 829221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117 830221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_MESSAGE_IMPRINT_MISMATCH 103 831221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_NONCE_MISMATCH 104 832221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_NONCE_NOT_RETURNED 105 833221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_NO_CONTENT 106 834221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_NO_TIME_STAMP_TOKEN 107 835221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118 836221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119 837221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129 838221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_POLICY_MISMATCH 108 839221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120 840221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_RESPONSE_SETUP_ERROR 121 841221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_SIGNATURE_FAILURE 109 842221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_THERE_MUST_BE_ONE_SIGNER 110 843221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TIME_SYSCALL_ERROR 122 844221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TOKEN_NOT_PRESENT 130 845221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TOKEN_PRESENT 131 846221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TSA_NAME_MISMATCH 111 847221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TSA_UNTRUSTED 112 848221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TST_INFO_SETUP_ERROR 123 849221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_TS_DATASIGN 124 850221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_UNACCEPTABLE_POLICY 125 851221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_UNSUPPORTED_MD_ALGORITHM 126 852221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_UNSUPPORTED_VERSION 113 853221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#define TS_R_WRONG_CONTENT_TYPE 114 854221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom 855221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifdef __cplusplus 856221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom} 857221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 858221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif 859