• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
4
5from __future__ import absolute_import, division, print_function
6
7INCLUDES = """
8#include <openssl/pkcs7.h>
9"""
10
11TYPES = """
12typedef struct {
13    Cryptography_STACK_OF_X509 *cert;
14    Cryptography_STACK_OF_X509_CRL *crl;
15    ...;
16} PKCS7_SIGNED;
17
18typedef struct {
19    Cryptography_STACK_OF_X509 *cert;
20    Cryptography_STACK_OF_X509_CRL *crl;
21    ...;
22} PKCS7_SIGN_ENVELOPE;
23
24typedef ... PKCS7_DIGEST;
25typedef ... PKCS7_ENCRYPT;
26typedef ... PKCS7_ENVELOPE;
27typedef ... PKCS7_SIGNER_INFO;
28
29typedef struct {
30    ASN1_OBJECT *type;
31    union {
32        char *ptr;
33        ASN1_OCTET_STRING *data;
34        PKCS7_SIGNED *sign;
35        PKCS7_ENVELOPE *enveloped;
36        PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
37        PKCS7_DIGEST *digest;
38        PKCS7_ENCRYPT *encrypted;
39        ASN1_TYPE *other;
40     } d;
41    ...;
42} PKCS7;
43
44static const int PKCS7_BINARY;
45static const int PKCS7_DETACHED;
46static const int PKCS7_NOATTR;
47static const int PKCS7_NOCERTS;
48static const int PKCS7_NOCHAIN;
49static const int PKCS7_NOINTERN;
50static const int PKCS7_NOSIGS;
51static const int PKCS7_NOSMIMECAP;
52static const int PKCS7_NOVERIFY;
53static const int PKCS7_STREAM;
54static const int PKCS7_TEXT;
55static const int PKCS7_PARTIAL;
56"""
57
58FUNCTIONS = """
59void PKCS7_free(PKCS7 *);
60PKCS7 *PKCS7_sign(X509 *, EVP_PKEY *, Cryptography_STACK_OF_X509 *,
61                   BIO *, int);
62int SMIME_write_PKCS7(BIO *, PKCS7 *, BIO *, int);
63int PEM_write_bio_PKCS7_stream(BIO *, PKCS7 *, BIO *, int);
64PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *, X509 *, EVP_PKEY *,
65                                         const EVP_MD *, int);
66int PKCS7_final(PKCS7 *, BIO *, int);
67/* Included verify due to external consumer, see
68   https://github.com/pyca/cryptography/issues/5433 */
69int PKCS7_verify(PKCS7 *, Cryptography_STACK_OF_X509 *, X509_STORE *, BIO *,
70                 BIO *, int);
71PKCS7 *SMIME_read_PKCS7(BIO *, BIO **);
72
73int PKCS7_type_is_signed(PKCS7 *);
74int PKCS7_type_is_enveloped(PKCS7 *);
75int PKCS7_type_is_signedAndEnveloped(PKCS7 *);
76int PKCS7_type_is_data(PKCS7 *);
77"""
78
79CUSTOMIZATIONS = ""
80