5 // Created by Martin Baulig on 14/11/15.
6 // Copyright (c) 2015 Xamarin. All rights reserved.
9 #ifndef __btls__btls_x509__
10 #define __btls__btls_x509__
14 #include "btls-x509-name.h"
17 MONO_BTLS_X509_FORMAT_DER
= 1,
18 MONO_BTLS_X509_FORMAT_PEM
= 2
22 MONO_BTLS_x509_FILE_TYPE_PEM
= 1, // X509_FILETYPE_PEM
23 MONO_BTLS_x509_FILE_TYPE_ASN1
= 2, // X509_FILETYPE_ASN1
24 MONO_BTLS_x509_FILE_TYPE_DEFAULT
= 3, // X509_FILETYPE_DEFAULT
25 } MonoBtlsX509FileType
;
28 MONO_BTLS_X509_PURPOSE_SSL_CLIENT
= 1,
29 MONO_BTLS_X509_PURPOSE_SSL_SERVER
= 2,
30 MONO_BTLS_X509_PURPOSE_NS_SSL_SERVER
= 3,
31 MONO_BTLS_X509_PURPOSE_SMIME_SIGN
= 4,
32 MONO_BTLS_X509_PURPOSE_SMIME_ENCRYPT
= 5,
33 MONO_BTLS_X509_PURPOSE_CRL_SIGN
= 6,
34 MONO_BTLS_X509_PURPOSE_ANY
= 7,
35 MONO_BTLS_X509_PURPOSE_OCSP_HELPER
= 8,
36 MONO_BTLS_X509_PURPOSE_TIMESTAMP_SIGN
= 9,
37 } MonoBtlsX509Purpose
;
40 MONO_BTLS_X509_TRUST_KIND_DEFAULT
= 0,
41 MONO_BTLS_X509_TRUST_KIND_TRUST_CLIENT
= 1,
42 MONO_BTLS_X509_TRUST_KIND_TRUST_SERVER
= 2,
43 MONO_BTLS_X509_TRUST_KIND_TRUST_ALL
= 4,
44 MONO_BTLS_X509_TRUST_KIND_REJECT_CLIENT
= 32,
45 MONO_BTLS_X509_TRUST_KIND_REJECT_SERVER
= 64,
46 MONO_BTLS_X509_TRUST_KIND_REJECT_ALL
= 128
47 } MonoBtlsX509TrustKind
;
50 mono_btls_x509_from_data (const void *buf
, int len
, MonoBtlsX509Format format
);
53 mono_btls_x509_up_ref (X509
*x509
);
56 mono_btls_x509_free (X509
*x509
);
59 mono_btls_x509_dup (X509
*x509
);
61 MONO_API MonoBtlsX509Name
*
62 mono_btls_x509_get_subject_name (X509
*x509
);
64 MONO_API MonoBtlsX509Name
*
65 mono_btls_x509_get_issuer_name (X509
*x509
);
68 mono_btls_x509_get_subject_name_string (X509
*name
, char *buffer
, int size
);
71 mono_btls_x509_get_issuer_name_string (X509
*name
, char *buffer
, int size
);
74 mono_btls_x509_get_raw_data (X509
*x509
, BIO
*bio
, MonoBtlsX509Format format
);
77 mono_btls_x509_cmp (const X509
*a
, const X509
*b
);
80 mono_btls_x509_get_hash (X509
*x509
, const void **data
);
83 mono_btls_x509_get_not_before (X509
*x509
);
86 mono_btls_x509_get_not_after (X509
*x509
);
89 mono_btls_x509_get_public_key (X509
*x509
, BIO
*bio
);
92 mono_btls_x509_get_public_key_parameters (X509
*x509
, char *out_oid
, int oid_len
, uint8_t **buffer
, int *size
);
95 mono_btls_x509_get_serial_number (X509
*x509
, char *buffer
, int size
, int mono_style
);
98 mono_btls_x509_get_public_key_algorithm (X509
*x509
, char *buffer
, int size
);
101 mono_btls_x509_get_version (X509
*x509
);
104 mono_btls_x509_get_signature_algorithm (X509
*x509
, char *buffer
, int size
);
107 mono_btls_x509_get_public_key_asn1 (X509
*x509
, char *out_oid
, int oid_len
, uint8_t **buffer
, int *size
);
110 mono_btls_x509_get_pubkey (X509
*x509
);
113 mono_btls_x509_get_subject_key_identifier (X509
*x509
, uint8_t **buffer
, int *size
);
116 mono_btls_x509_print (X509
*x509
, BIO
*bio
);
119 mono_btls_x509_add_trust_object (X509
*x509
, MonoBtlsX509Purpose purpose
);
122 mono_btls_x509_add_reject_object (X509
*x509
, MonoBtlsX509Purpose purpose
);
125 mono_btls_x509_add_explicit_trust (X509
*x509
, MonoBtlsX509TrustKind kind
);
127 #endif /* defined(__btls__btls_x509__) */