Lines Matching +full:serial +full:- +full:out
2 * Copyright 2006-2025 The OpenSSL Project Authors. All Rights Reserved.
41 int cert, const char *in, const char *out, int text);
53 const char *out, int token_out, int text);
61 static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial);
91 {"help", OPT_HELP, '-', "Display this summary"},
104 {"token_in", OPT_TOKEN_IN, '-', "Input is a PKCS#7 file"},
105 {"token_out", OPT_TOKEN_OUT, '-', "Output is a PKCS#7 file"},
107 {"", OPT_MD, '-', "Any supported digest"},
110 {"query", OPT_QUERY, '-', "Generate a TS query"},
114 {"cert", OPT_CERT, '-', "Put cert request into query"},
118 {"verify", OPT_VERIFY, '-', "Verify a TS response"},
119 {"reply", OPT_REPLY, '-', "Generate a TS reply"},
121 {"no_nonce", OPT_NO_NONCE, '-', "Do not include a nonce"},
122 {"out", OPT_OUT, '>', "Output file"},
123 {"text", OPT_TEXT, '-', "Output text (not DER)"},
137 " openssl ts -query [-rand file...] [-config file] [-data file]",
138 " [-digest hexstring] [-tspolicy oid] [-no_nonce] [-cert]",
139 " [-in file] [-out file] [-text]",
141 " openssl ts -reply [-config file] [-section tsa_section]",
142 " [-queryfile file] [-passin password]",
143 " [-signer tsa_cert.pem] [-inkey private_key.pem]",
144 " [-chain certs_file.pem] [-tspolicy oid]",
145 " [-in file] [-token_in] [-out file] [-token_out]",
147 " [-text] [-engine id]",
149 " [-text]",
152 " openssl ts -verify -CApath dir -CAfile root-cert.pem -CAstore uri",
153 " -untrusted extra-certs.pem [-data file] [-digest hexstring]",
154 " [-queryfile request.tsq] -in response.tsr [-token_in] ...",
168 char *in = NULL, *out = NULL, *queryfile = NULL, *passin = NULL; in ts_main() local
191 BIO_printf(bio_err, "%s: Use -help for summary.\n", prog); in ts_main()
209 BIO_printf(bio_err, "%s: Must give only one of -query, -reply, or -verify\n", prog); in ts_main()
244 out = opt_arg(); in ts_main()
297 BIO_printf(bio_err, "%s: Must give one of -query, -reply, or -verify\n", prog); in ts_main()
324 in, out, text); in ts_main()
336 in, token_in, out, token_out, text); in ts_main()
357 * Configuration file-related function definitions.
395 * Query-related method definitions.
399 int cert, const char *in, const char *out, int text) in query_command() argument
422 if ((out_bio = bio_open_default(out, 'w', FORMAT_TEXT)) == NULL) in query_command()
427 if ((out_bio = bio_open_default(out, 'w', FORMAT_ASN1)) == NULL) in query_command()
466 if ((algo->algorithm = OBJ_nid2obj(EVP_MD_get_type(md))) == NULL) in create_query()
468 if ((algo->parameter = ASN1_TYPE_new()) == NULL) in create_query()
470 algo->parameter->type = V_ASN1_NULL; in create_query()
561 int len = (bits - 1) / 8 + 1; in create_nonce()
569 /* Find the first non-zero byte and creating ASN1_INTEGER object. */ in create_nonce()
574 OPENSSL_free(nonce->data); in create_nonce()
575 nonce->length = len - i; in create_nonce()
576 nonce->data = app_malloc(nonce->length + 1, "nonce buffer"); in create_nonce()
577 memcpy(nonce->data, buf + i, nonce->length); in create_nonce()
587 * Reply-related method definitions.
594 const char *out, int token_out, int text) in reply_command() argument
625 if ((out_bio = bio_open_default(out, 'w', FORMAT_TEXT)) == NULL) in reply_command()
636 if ((out_bio = bio_open_default(out, 'w', FORMAT_ASN1)) == NULL) in reply_command()
769 ASN1_INTEGER *serial = next_serial(serial_file); in serial_cb() local
771 if (serial == NULL) { in serial_cb()
773 "Error during serial number " in serial_cb()
777 save_ts_serial(serial_file, serial); in serial_cb()
780 return serial; in serial_cb()
787 ASN1_INTEGER *serial = NULL; in next_serial() local
790 if ((serial = ASN1_INTEGER_new()) == NULL) in next_serial()
796 "reading, using serial number: 1\n", serialfile); in next_serial()
797 if (!ASN1_INTEGER_set(serial, 1)) in next_serial()
801 if (!a2i_ASN1_INTEGER(in, serial, buf, sizeof(buf))) { in next_serial()
806 if ((bn = ASN1_INTEGER_to_BN(serial, NULL)) == NULL) in next_serial()
808 ASN1_INTEGER_free(serial); in next_serial()
809 serial = NULL; in next_serial()
812 if ((serial = BN_to_ASN1_INTEGER(bn, NULL)) == NULL) in next_serial()
819 ASN1_INTEGER_free(serial); in next_serial()
820 serial = NULL; in next_serial()
824 return serial; in next_serial()
827 static int save_ts_serial(const char *serialfile, ASN1_INTEGER *serial) in save_ts_serial() argument
830 BIO *out = NULL; in save_ts_serial() local
832 if ((out = BIO_new_file(serialfile, "w")) == NULL) in save_ts_serial()
834 if (i2a_ASN1_INTEGER(out, serial) <= 0) in save_ts_serial()
836 if (BIO_puts(out, "\n") <= 0) in save_ts_serial()
841 BIO_printf(bio_err, "could not save serial number to %s\n", in save_ts_serial()
843 BIO_free_all(out); in save_ts_serial()
849 * Verify-related method definitions.
918 BIO *out = NULL; in create_verify_ctx() local
921 if ((out = BIO_new_file(data, "rb")) == NULL) in create_verify_ctx()
923 if (!TS_VERIFY_CTX_set0_data(ctx, out)) { in create_verify_ctx()
924 BIO_free_all(out); in create_verify_ctx()