|
| 1 | +unit module OpenSSL::X509_Store_Ctx; |
| 2 | + |
| 3 | +use v6; |
| 4 | +use NativeCall; |
| 5 | +use OpenSSL::NativeLib; |
| 6 | + |
| 7 | + |
| 8 | +# struct crypto_ex_data_st { |
| 9 | +# STACK_OF(void) *sk; |
| 10 | +# }; |
| 11 | +# class CRYPTO_EX_DATA is repr('CStruct') { |
| 12 | +# has Pointer $.sk; |
| 13 | +#} |
| 14 | + |
| 15 | + |
| 16 | +# class X509_STORE_CTX is repr('CStruct') { |
| 17 | +# # X509_STORE *ctx; |
| 18 | +# has OpaquePointer $.ctx; |
| 19 | + |
| 20 | +# # /* The following are set by the caller */ |
| 21 | +# # /* The cert to check */ |
| 22 | +# # X509 *cert; |
| 23 | +# has OpaquePointer $.cert; |
| 24 | + |
| 25 | +# # /* chain of X509s - untrusted - passed in */ |
| 26 | +# # STACK_OF(X509) *untrusted; |
| 27 | +# has Pointer $.untrusted; |
| 28 | + |
| 29 | +# # /* set of CRLs passed in */ |
| 30 | +# # STACK_OF(X509_CRL) *crls; |
| 31 | +# # X509_VERIFY_PARAM *param; |
| 32 | +# has Pointer $.crls; |
| 33 | +# has Pointer $.param; |
| 34 | + |
| 35 | +# # /* Other info for use with get_issuer() */ |
| 36 | +# # void *other_ctx; |
| 37 | +# has Pointer $.other_ctx; |
| 38 | + |
| 39 | +# # /* Callbacks for various operations */ |
| 40 | +# # /* called to verify a certificate */ |
| 41 | +# # int (*verify) (X509_STORE_CTX *ctx) |
| 42 | +# has Pointer $.verify; |
| 43 | + |
| 44 | +# # /* error callback */ |
| 45 | +# # int (*verify_cb) (int ok, X509_STORE_CTX *ctx); |
| 46 | +# has Pointer $.verify_cb; |
| 47 | + |
| 48 | +# # /* get issuers cert from ctx */ |
| 49 | +# # int (*get_issuer) (X509 **issuer, X509_STORE_CTX *ctx, X509 *x); |
| 50 | +# has Pointer $.get_issuer; |
| 51 | + |
| 52 | +# # /* check issued */ |
| 53 | +# # int (*check_issued) (X509_STORE_CTX *ctx, X509 *x, X509 *issuer); |
| 54 | +# has Pointer $.check_issued; |
| 55 | + |
| 56 | +# # /* Check revocation status of chain */ |
| 57 | +# # int (*check_revocation) (X509_STORE_CTX *ctx); |
| 58 | +# has Pointer $.check_revocation; |
| 59 | + |
| 60 | +# # /* retrieve CRL */ |
| 61 | +# # int (*get_crl) (X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); |
| 62 | +# has Pointer $.get_crl; |
| 63 | + |
| 64 | +# # /* Check CRL validity */ |
| 65 | +# # int (*check_crl) (X509_STORE_CTX *ctx, X509_CRL *crl); |
| 66 | +# has Pointer $.check_crl; |
| 67 | + |
| 68 | +# # /* Check certificate against CRL */ |
| 69 | +# # int (*cert_crl) (X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); |
| 70 | +# has Pointer $.cert_crl; |
| 71 | + |
| 72 | +# # /* Check policy status of the chain */ |
| 73 | +# # int (*check_policy) (X509_STORE_CTX *ctx); |
| 74 | +# has Pointer $.check_policy; |
| 75 | + |
| 76 | +# # STACK_OF(X509) *(*lookup_certs) (X509_STORE_CTX *ctx, X509_NAME *nm); |
| 77 | +# has Pointer $.lookup_certs; |
| 78 | + |
| 79 | +# # STACK_OF(X509_CRL) *(*lookup_crls) (X509_STORE_CTX *ctx, X509_NAME *nm); |
| 80 | +# has Pointer $.lookup_crls; |
| 81 | + |
| 82 | +# # int (*cleanup) (X509_STORE_CTX *ctx); |
| 83 | +# has Pointer $.cleanup; |
| 84 | + |
| 85 | +# # /* The following is built up */ |
| 86 | +# # /* if 0, rebuild chain */ |
| 87 | +# # int valid; |
| 88 | +# has int32 $.valid; |
| 89 | + |
| 90 | +# # /* number of untrusted certs */ |
| 91 | +# # int num_untrusted; |
| 92 | +# has int32 $.num_untrusted; |
| 93 | + |
| 94 | +# # /* chain of X509s - built up and trusted */ |
| 95 | +# # STACK_OF(X509) *chain; |
| 96 | +# has Pointer $.chain; |
| 97 | + |
| 98 | +# # /* Valid policy tree */ |
| 99 | +# # X509_POLICY_TREE *tree; |
| 100 | +# has Pointer $.tree; |
| 101 | + |
| 102 | +# # /* Require explicit policy value */ |
| 103 | +# # int explicit_policy; |
| 104 | +# has int32 $explicit_policy; |
| 105 | + |
| 106 | +# # /* When something goes wrong, this is why */ |
| 107 | +# # int error_depth; |
| 108 | +# has int32 $.error_depth; |
| 109 | + |
| 110 | +# # int error; |
| 111 | +# has int32 $.error; |
| 112 | + |
| 113 | +# # X509 *current_cert; |
| 114 | +# has Pointer $.current_cert; |
| 115 | + |
| 116 | +# # /* cert currently being tested as valid issuer */ |
| 117 | +# # X509 *current_issuer; |
| 118 | +# has Pointer $.current_issuer; |
| 119 | + |
| 120 | +# # /* current CRL */ |
| 121 | +# # X509_CRL *current_crl; |
| 122 | +# has Pointer $.current_crl; |
| 123 | + |
| 124 | +# # /* score of current CRL */ |
| 125 | +# # int current_crl_score; |
| 126 | +# has int32 $.current_crl_score; |
| 127 | + |
| 128 | +# # /* Reason mask */ |
| 129 | +# # unsigned int current_reasons; |
| 130 | +# has uint32 $.current_reasons; |
| 131 | + |
| 132 | +# # /* For CRL path validation: parent context */ |
| 133 | +# # X509_STORE_CTX *parent; |
| 134 | +# has OpenSSL::Ctx::X509_STORE_CTX $.parent; |
| 135 | +# # CRYPTO_EX_DATA ex_data; |
| 136 | +# HAS CRYPTO_EX_DATA $.ex_data; |
| 137 | + |
| 138 | +# # SSL_DANE *dane; |
| 139 | +# has Pointer $.dane; |
| 140 | + |
| 141 | +# # /* signed via bare TA public key, rather than CA certificate */ |
| 142 | +# # int bare_ta_signed; |
| 143 | +# has int32 $.bare_ta_signed; |
| 144 | +# } |
| 145 | + |
| 146 | +our sub X509_STORE_CTX_get_current_cert(Pointer) returns Pointer is native(&ssl-lib) { ... } |
| 147 | +our sub X509_STORE_CTX_get_error_depth(Pointer) returns int32 is native(&ssl-lib) { ... } |
0 commit comments