licentivo-launch 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/ext/launch_native/extconf.rb +28 -0
  5. data/lib/licentivo_launch/vendor/licentivo.rb +262 -0
  6. data/lib/licentivo_launch.rb +352 -0
  7. data/vendor/LICENSE +21 -0
  8. data/vendor/NOTICE +17 -0
  9. data/vendor/VERSION +1 -0
  10. data/vendor/c/app.c +33 -0
  11. data/vendor/c/demo.c +77 -0
  12. data/vendor/c/feature_tasks.h +72 -0
  13. data/vendor/c/licentivo.c +382 -0
  14. data/vendor/c/licentivo.h +67 -0
  15. data/vendor/c/quickstart.c +51 -0
  16. data/vendor/c/test_vectors.c +4 -0
  17. data/vendor/c/vendor/Monocypher-LICENCE.md +173 -0
  18. data/vendor/c/vendor/cJSON-LICENSE +20 -0
  19. data/vendor/c/vendor/cJSON.c +3191 -0
  20. data/vendor/c/vendor/cJSON.h +306 -0
  21. data/vendor/c/vendor/monocypher-ed25519.c +500 -0
  22. data/vendor/c/vendor/monocypher-ed25519.h +140 -0
  23. data/vendor/c/vendor/monocypher.c +2956 -0
  24. data/vendor/c/vendor/monocypher.h +321 -0
  25. data/vendor/curl/COPYING.txt +22 -0
  26. data/vendor/curl/bin/libcurl-x64.dll +0 -0
  27. data/vendor/curl/include/brotli/decode.h +409 -0
  28. data/vendor/curl/include/brotli/encode.h +505 -0
  29. data/vendor/curl/include/brotli/port.h +302 -0
  30. data/vendor/curl/include/brotli/shared_dictionary.h +100 -0
  31. data/vendor/curl/include/brotli/types.h +83 -0
  32. data/vendor/curl/include/curl/curl.h +3374 -0
  33. data/vendor/curl/include/curl/curlver.h +77 -0
  34. data/vendor/curl/include/curl/easy.h +123 -0
  35. data/vendor/curl/include/curl/header.h +74 -0
  36. data/vendor/curl/include/curl/mprintf.h +85 -0
  37. data/vendor/curl/include/curl/multi.h +561 -0
  38. data/vendor/curl/include/curl/options.h +70 -0
  39. data/vendor/curl/include/curl/stdcheaders.h +35 -0
  40. data/vendor/curl/include/curl/system.h +399 -0
  41. data/vendor/curl/include/curl/typecheck-gcc.h +964 -0
  42. data/vendor/curl/include/curl/urlapi.h +156 -0
  43. data/vendor/curl/include/curl/websockets.h +98 -0
  44. data/vendor/curl/include/libpsl.h +207 -0
  45. data/vendor/curl/include/libssh2.h +1516 -0
  46. data/vendor/curl/include/libssh2_publickey.h +128 -0
  47. data/vendor/curl/include/libssh2_sftp.h +382 -0
  48. data/vendor/curl/include/nghttp2/nghttp2.h +6878 -0
  49. data/vendor/curl/include/nghttp2/nghttp2ver.h +42 -0
  50. data/vendor/curl/include/nghttp3/nghttp3.h +3704 -0
  51. data/vendor/curl/include/nghttp3/version.h +46 -0
  52. data/vendor/curl/include/ngtcp2/ngtcp2.h +7485 -0
  53. data/vendor/curl/include/ngtcp2/ngtcp2_crypto.h +1071 -0
  54. data/vendor/curl/include/ngtcp2/ngtcp2_crypto_quictls.h +147 -0
  55. data/vendor/curl/include/ngtcp2/version.h +51 -0
  56. data/vendor/curl/include/openssl/aes.h +120 -0
  57. data/vendor/curl/include/openssl/asn1.h +1121 -0
  58. data/vendor/curl/include/openssl/asn1t.h +996 -0
  59. data/vendor/curl/include/openssl/bio.h +716 -0
  60. data/vendor/curl/include/openssl/blowfish.h +106 -0
  61. data/vendor/curl/include/openssl/bn.h +480 -0
  62. data/vendor/curl/include/openssl/buffer.h +102 -0
  63. data/vendor/curl/include/openssl/camellia.h +121 -0
  64. data/vendor/curl/include/openssl/cast.h +99 -0
  65. data/vendor/curl/include/openssl/chacha.h +54 -0
  66. data/vendor/curl/include/openssl/cmac.h +81 -0
  67. data/vendor/curl/include/openssl/cms.h +541 -0
  68. data/vendor/curl/include/openssl/comp.h +7 -0
  69. data/vendor/curl/include/openssl/conf.h +189 -0
  70. data/vendor/curl/include/openssl/crypto.h +458 -0
  71. data/vendor/curl/include/openssl/ct.h +567 -0
  72. data/vendor/curl/include/openssl/curve25519.h +104 -0
  73. data/vendor/curl/include/openssl/des.h +215 -0
  74. data/vendor/curl/include/openssl/dh.h +245 -0
  75. data/vendor/curl/include/openssl/dsa.h +263 -0
  76. data/vendor/curl/include/openssl/dtls1.h +107 -0
  77. data/vendor/curl/include/openssl/ec.h +675 -0
  78. data/vendor/curl/include/openssl/ecdh.h +6 -0
  79. data/vendor/curl/include/openssl/ecdsa.h +6 -0
  80. data/vendor/curl/include/openssl/engine.h +215 -0
  81. data/vendor/curl/include/openssl/err.h +325 -0
  82. data/vendor/curl/include/openssl/evp.h +1288 -0
  83. data/vendor/curl/include/openssl/hkdf.h +65 -0
  84. data/vendor/curl/include/openssl/hmac.h +101 -0
  85. data/vendor/curl/include/openssl/idea.h +99 -0
  86. data/vendor/curl/include/openssl/kdf.h +137 -0
  87. data/vendor/curl/include/openssl/lhash.h +179 -0
  88. data/vendor/curl/include/openssl/md4.h +105 -0
  89. data/vendor/curl/include/openssl/md5.h +99 -0
  90. data/vendor/curl/include/openssl/mlkem.h +236 -0
  91. data/vendor/curl/include/openssl/modes.h +118 -0
  92. data/vendor/curl/include/openssl/obj_mac.h +4646 -0
  93. data/vendor/curl/include/openssl/objects.h +137 -0
  94. data/vendor/curl/include/openssl/ocsp.h +484 -0
  95. data/vendor/curl/include/openssl/opensslconf.h +16 -0
  96. data/vendor/curl/include/openssl/opensslfeatures.h +153 -0
  97. data/vendor/curl/include/openssl/opensslv.h +18 -0
  98. data/vendor/curl/include/openssl/ossl_typ.h +196 -0
  99. data/vendor/curl/include/openssl/pem.h +542 -0
  100. data/vendor/curl/include/openssl/pkcs12.h +284 -0
  101. data/vendor/curl/include/openssl/pkcs7.h +523 -0
  102. data/vendor/curl/include/openssl/poly1305.h +45 -0
  103. data/vendor/curl/include/openssl/posix_time.h +54 -0
  104. data/vendor/curl/include/openssl/rand.h +118 -0
  105. data/vendor/curl/include/openssl/rc2.h +101 -0
  106. data/vendor/curl/include/openssl/rc4.h +88 -0
  107. data/vendor/curl/include/openssl/ripemd.h +107 -0
  108. data/vendor/curl/include/openssl/rsa.h +603 -0
  109. data/vendor/curl/include/openssl/safestack.h +1739 -0
  110. data/vendor/curl/include/openssl/sha.h +190 -0
  111. data/vendor/curl/include/openssl/sm3.h +49 -0
  112. data/vendor/curl/include/openssl/sm4.h +47 -0
  113. data/vendor/curl/include/openssl/srtp.h +148 -0
  114. data/vendor/curl/include/openssl/ssl.h +2336 -0
  115. data/vendor/curl/include/openssl/ssl3.h +441 -0
  116. data/vendor/curl/include/openssl/stack.h +99 -0
  117. data/vendor/curl/include/openssl/tls1.h +764 -0
  118. data/vendor/curl/include/openssl/ts.h +660 -0
  119. data/vendor/curl/include/openssl/txt_db.h +112 -0
  120. data/vendor/curl/include/openssl/ui.h +397 -0
  121. data/vendor/curl/include/openssl/x509.h +1037 -0
  122. data/vendor/curl/include/openssl/x509_vfy.h +464 -0
  123. data/vendor/curl/include/openssl/x509v3.h +1039 -0
  124. data/vendor/curl/include/zconf.h +206 -0
  125. data/vendor/curl/include/zdict.h +481 -0
  126. data/vendor/curl/include/zlib.h +1859 -0
  127. data/vendor/curl/include/zlib_name_mangling.h +8 -0
  128. data/vendor/curl/include/zstd.h +3198 -0
  129. data/vendor/curl/include/zstd_errors.h +107 -0
  130. data/vendor/curl/lib/libcurl.dll.a +0 -0
  131. data/vendor/curl/licenses/brotli/LICENSE.txt +19 -0
  132. data/vendor/curl/licenses/certdata/LICENSE.url +2 -0
  133. data/vendor/curl/licenses/libpsl/COPYING.txt +20 -0
  134. data/vendor/curl/licenses/libressl/COPYING.txt +133 -0
  135. data/vendor/curl/licenses/libssh2/COPYING.txt +43 -0
  136. data/vendor/curl/licenses/nghttp2/COPYING.txt +23 -0
  137. data/vendor/curl/licenses/nghttp3/COPYING.txt +22 -0
  138. data/vendor/curl/licenses/ngtcp2/COPYING.txt +22 -0
  139. data/vendor/curl/licenses/psl/LICENSE.txt +373 -0
  140. data/vendor/curl/licenses/trurl/COPYING.txt +22 -0
  141. data/vendor/curl/licenses/zlibng/LICENSE.md +19 -0
  142. data/vendor/curl/licenses/zstd/LICENSE.txt +30 -0
  143. metadata +205 -0
@@ -0,0 +1,542 @@
1
+ /* $OpenBSD: pem.h,v 1.29 2025/07/16 15:59:26 tb Exp $ */
2
+ /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3
+ * All rights reserved.
4
+ *
5
+ * This package is an SSL implementation written
6
+ * by Eric Young (eay@cryptsoft.com).
7
+ * The implementation was written so as to conform with Netscapes SSL.
8
+ *
9
+ * This library is free for commercial and non-commercial use as long as
10
+ * the following conditions are aheared to. The following conditions
11
+ * apply to all code found in this distribution, be it the RC4, RSA,
12
+ * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13
+ * included with this distribution is covered by the same copyright terms
14
+ * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15
+ *
16
+ * Copyright remains Eric Young's, and as such any Copyright notices in
17
+ * the code are not to be removed.
18
+ * If this package is used in a product, Eric Young should be given attribution
19
+ * as the author of the parts of the library used.
20
+ * This can be in the form of a textual message at program startup or
21
+ * in documentation (online or textual) provided with the package.
22
+ *
23
+ * Redistribution and use in source and binary forms, with or without
24
+ * modification, are permitted provided that the following conditions
25
+ * are met:
26
+ * 1. Redistributions of source code must retain the copyright
27
+ * notice, this list of conditions and the following disclaimer.
28
+ * 2. Redistributions in binary form must reproduce the above copyright
29
+ * notice, this list of conditions and the following disclaimer in the
30
+ * documentation and/or other materials provided with the distribution.
31
+ * 3. All advertising materials mentioning features or use of this software
32
+ * must display the following acknowledgement:
33
+ * "This product includes cryptographic software written by
34
+ * Eric Young (eay@cryptsoft.com)"
35
+ * The word 'cryptographic' can be left out if the rouines from the library
36
+ * being used are not cryptographic related :-).
37
+ * 4. If you include any Windows specific code (or a derivative thereof) from
38
+ * the apps directory (application code) you must include an acknowledgement:
39
+ * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40
+ *
41
+ * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51
+ * SUCH DAMAGE.
52
+ *
53
+ * The licence and distribution terms for any publically available version or
54
+ * derivative of this code cannot be changed. i.e. this code cannot simply be
55
+ * copied and put under another distribution licence
56
+ * [including the GNU Public Licence.]
57
+ */
58
+
59
+ #ifndef HEADER_PEM_H
60
+ #define HEADER_PEM_H
61
+
62
+ #include <openssl/opensslconf.h>
63
+
64
+ #ifndef OPENSSL_NO_BIO
65
+ #include <openssl/bio.h>
66
+ #endif
67
+ #ifndef OPENSSL_NO_STACK
68
+ #include <openssl/stack.h>
69
+ #endif
70
+ #include <openssl/evp.h>
71
+ #include <openssl/x509.h>
72
+
73
+ #ifdef __cplusplus
74
+ extern "C" {
75
+ #endif
76
+
77
+ #define PEM_BUFSIZE 1024
78
+
79
+ #define PEM_OBJ_UNDEF 0
80
+ #define PEM_OBJ_X509 1
81
+ #define PEM_OBJ_X509_REQ 2
82
+ #define PEM_OBJ_CRL 3
83
+ #define PEM_OBJ_SSL_SESSION 4
84
+ #define PEM_OBJ_PRIV_KEY 10
85
+ #define PEM_OBJ_PRIV_RSA 11
86
+ #define PEM_OBJ_PRIV_DSA 12
87
+ #define PEM_OBJ_PRIV_DH 13
88
+ #define PEM_OBJ_PUB_RSA 14
89
+ #define PEM_OBJ_PUB_DSA 15
90
+ #define PEM_OBJ_PUB_DH 16
91
+ #define PEM_OBJ_DHPARAMS 17
92
+ #define PEM_OBJ_DSAPARAMS 18
93
+ #define PEM_OBJ_PRIV_RSA_PUBLIC 19
94
+ #define PEM_OBJ_PRIV_ECDSA 20
95
+ #define PEM_OBJ_PUB_ECDSA 21
96
+ #define PEM_OBJ_ECPARAMETERS 22
97
+
98
+ #define PEM_ERROR 30
99
+ #define PEM_DEK_DES_CBC 40
100
+ #define PEM_DEK_IDEA_CBC 45
101
+ #define PEM_DEK_DES_EDE 50
102
+ #define PEM_DEK_DES_ECB 60
103
+ #define PEM_DEK_RSA 70
104
+ #define PEM_DEK_RSA_MD2 80
105
+ #define PEM_DEK_RSA_MD5 90
106
+
107
+ #define PEM_MD_MD2 NID_md2
108
+ #define PEM_MD_MD5 NID_md5
109
+ #define PEM_MD_SHA NID_sha
110
+ #define PEM_MD_MD2_RSA NID_md2WithRSAEncryption
111
+ #define PEM_MD_MD5_RSA NID_md5WithRSAEncryption
112
+ #define PEM_MD_SHA_RSA NID_sha1WithRSAEncryption
113
+
114
+ #define PEM_STRING_X509_OLD "X509 CERTIFICATE"
115
+ #define PEM_STRING_X509 "CERTIFICATE"
116
+ #define PEM_STRING_X509_TRUSTED "TRUSTED CERTIFICATE"
117
+ #define PEM_STRING_X509_REQ_OLD "NEW CERTIFICATE REQUEST"
118
+ #define PEM_STRING_X509_REQ "CERTIFICATE REQUEST"
119
+ #define PEM_STRING_X509_CRL "X509 CRL"
120
+ #define PEM_STRING_EVP_PKEY "ANY PRIVATE KEY"
121
+ #define PEM_STRING_PUBLIC "PUBLIC KEY"
122
+ #define PEM_STRING_RSA "RSA PRIVATE KEY"
123
+ #define PEM_STRING_RSA_PUBLIC "RSA PUBLIC KEY"
124
+ #define PEM_STRING_DSA "DSA PRIVATE KEY"
125
+ #define PEM_STRING_DSA_PUBLIC "DSA PUBLIC KEY"
126
+ #define PEM_STRING_PKCS7 "PKCS7"
127
+ #define PEM_STRING_PKCS7_SIGNED "PKCS #7 SIGNED DATA"
128
+ #define PEM_STRING_PKCS8 "ENCRYPTED PRIVATE KEY"
129
+ #define PEM_STRING_PKCS8INF "PRIVATE KEY"
130
+ #define PEM_STRING_DHPARAMS "DH PARAMETERS"
131
+ #define PEM_STRING_SSL_SESSION "SSL SESSION PARAMETERS"
132
+ #define PEM_STRING_DSAPARAMS "DSA PARAMETERS"
133
+ #define PEM_STRING_ECDSA_PUBLIC "ECDSA PUBLIC KEY"
134
+ #define PEM_STRING_ECPARAMETERS "EC PARAMETERS"
135
+ #define PEM_STRING_ECPRIVATEKEY "EC PRIVATE KEY"
136
+ #define PEM_STRING_PARAMETERS "PARAMETERS"
137
+ #define PEM_STRING_CMS "CMS"
138
+
139
+ /* enc_type is one off */
140
+ #define PEM_TYPE_ENCRYPTED 10
141
+ #define PEM_TYPE_MIC_ONLY 20
142
+ #define PEM_TYPE_MIC_CLEAR 30
143
+ #define PEM_TYPE_CLEAR 40
144
+
145
+ #ifndef LIBRESSL_INTERNAL
146
+ /* These macros make the PEM_read/PEM_write functions easier to maintain and
147
+ * write. Now they are all implemented with either:
148
+ * IMPLEMENT_PEM_rw(...) or IMPLEMENT_PEM_rw_cb(...)
149
+ */
150
+
151
+ #define IMPLEMENT_PEM_read_fp(name, type, str, asn1) \
152
+ type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u)\
153
+ { \
154
+ return PEM_ASN1_read((d2i_of_void *)d2i_##asn1, str,fp,(void **)x,cb,u); \
155
+ }
156
+
157
+ #define IMPLEMENT_PEM_write_fp(name, type, str, asn1) \
158
+ int PEM_write_##name(FILE *fp, type *x) \
159
+ { \
160
+ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,NULL,NULL,0,NULL,NULL); \
161
+ }
162
+
163
+ #define IMPLEMENT_PEM_write_fp_const(name, type, str, asn1) \
164
+ int PEM_write_##name(FILE *fp, const type *x) \
165
+ { \
166
+ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,(void *)x,NULL,NULL,0,NULL,NULL); \
167
+ }
168
+
169
+ #define IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1) \
170
+ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
171
+ unsigned char *kstr, int klen, pem_password_cb *cb, \
172
+ void *u) \
173
+ { \
174
+ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
175
+ }
176
+
177
+ #define IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1) \
178
+ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
179
+ unsigned char *kstr, int klen, pem_password_cb *cb, \
180
+ void *u) \
181
+ { \
182
+ return PEM_ASN1_write((i2d_of_void *)i2d_##asn1,str,fp,x,enc,kstr,klen,cb,u); \
183
+ }
184
+
185
+
186
+ #define IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
187
+ type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u)\
188
+ { \
189
+ return PEM_ASN1_read_bio((d2i_of_void *)d2i_##asn1, str,bp,(void **)x,cb,u); \
190
+ }
191
+
192
+ #define IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
193
+ int PEM_write_bio_##name(BIO *bp, type *x) \
194
+ { \
195
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,NULL,NULL,0,NULL,NULL); \
196
+ }
197
+
198
+ #define IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
199
+ int PEM_write_bio_##name(BIO *bp, const type *x) \
200
+ { \
201
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,NULL,NULL,0,NULL,NULL); \
202
+ }
203
+
204
+ #define IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
205
+ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
206
+ unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
207
+ { \
208
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,x,enc,kstr,klen,cb,u); \
209
+ }
210
+
211
+ #define IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
212
+ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
213
+ unsigned char *kstr, int klen, pem_password_cb *cb, void *u) \
214
+ { \
215
+ return PEM_ASN1_write_bio((i2d_of_void *)i2d_##asn1,str,bp,(void *)x,enc,kstr,klen,cb,u); \
216
+ }
217
+
218
+ #define IMPLEMENT_PEM_write(name, type, str, asn1) \
219
+ IMPLEMENT_PEM_write_bio(name, type, str, asn1) \
220
+ IMPLEMENT_PEM_write_fp(name, type, str, asn1)
221
+
222
+ #define IMPLEMENT_PEM_write_const(name, type, str, asn1) \
223
+ IMPLEMENT_PEM_write_bio_const(name, type, str, asn1) \
224
+ IMPLEMENT_PEM_write_fp_const(name, type, str, asn1)
225
+
226
+ #define IMPLEMENT_PEM_write_cb(name, type, str, asn1) \
227
+ IMPLEMENT_PEM_write_cb_bio(name, type, str, asn1) \
228
+ IMPLEMENT_PEM_write_cb_fp(name, type, str, asn1)
229
+
230
+ #define IMPLEMENT_PEM_write_cb_const(name, type, str, asn1) \
231
+ IMPLEMENT_PEM_write_cb_bio_const(name, type, str, asn1) \
232
+ IMPLEMENT_PEM_write_cb_fp_const(name, type, str, asn1)
233
+
234
+ #define IMPLEMENT_PEM_read(name, type, str, asn1) \
235
+ IMPLEMENT_PEM_read_bio(name, type, str, asn1) \
236
+ IMPLEMENT_PEM_read_fp(name, type, str, asn1)
237
+
238
+ #define IMPLEMENT_PEM_rw(name, type, str, asn1) \
239
+ IMPLEMENT_PEM_read(name, type, str, asn1) \
240
+ IMPLEMENT_PEM_write(name, type, str, asn1)
241
+
242
+ #define IMPLEMENT_PEM_rw_const(name, type, str, asn1) \
243
+ IMPLEMENT_PEM_read(name, type, str, asn1) \
244
+ IMPLEMENT_PEM_write_const(name, type, str, asn1)
245
+
246
+ #define IMPLEMENT_PEM_rw_cb(name, type, str, asn1) \
247
+ IMPLEMENT_PEM_read(name, type, str, asn1) \
248
+ IMPLEMENT_PEM_write_cb(name, type, str, asn1)
249
+
250
+ #endif
251
+
252
+ /* These are the same except they are for the declarations */
253
+
254
+
255
+ #define DECLARE_PEM_read_fp(name, type) \
256
+ type *PEM_read_##name(FILE *fp, type **x, pem_password_cb *cb, void *u);
257
+
258
+ #define DECLARE_PEM_write_fp(name, type) \
259
+ int PEM_write_##name(FILE *fp, type *x);
260
+
261
+ #define DECLARE_PEM_write_fp_const(name, type) \
262
+ int PEM_write_##name(FILE *fp, const type *x);
263
+
264
+ #define DECLARE_PEM_write_cb_fp(name, type) \
265
+ int PEM_write_##name(FILE *fp, type *x, const EVP_CIPHER *enc, \
266
+ unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
267
+
268
+
269
+ #ifndef OPENSSL_NO_BIO
270
+ #define DECLARE_PEM_read_bio(name, type) \
271
+ type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
272
+
273
+ #define DECLARE_PEM_write_bio(name, type) \
274
+ int PEM_write_bio_##name(BIO *bp, type *x);
275
+
276
+ #define DECLARE_PEM_write_bio_const(name, type) \
277
+ int PEM_write_bio_##name(BIO *bp, const type *x);
278
+
279
+ #define DECLARE_PEM_write_cb_bio(name, type) \
280
+ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
281
+ unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
282
+
283
+ #else
284
+
285
+ #define DECLARE_PEM_read_bio(name, type) /**/
286
+ #define DECLARE_PEM_write_bio(name, type) /**/
287
+ #define DECLARE_PEM_write_bio_const(name, type) /**/
288
+ #define DECLARE_PEM_write_cb_bio(name, type) /**/
289
+
290
+ #endif
291
+
292
+ #define DECLARE_PEM_write(name, type) \
293
+ DECLARE_PEM_write_bio(name, type) \
294
+ DECLARE_PEM_write_fp(name, type)
295
+
296
+ #define DECLARE_PEM_write_const(name, type) \
297
+ DECLARE_PEM_write_bio_const(name, type) \
298
+ DECLARE_PEM_write_fp_const(name, type)
299
+
300
+ #define DECLARE_PEM_write_cb(name, type) \
301
+ DECLARE_PEM_write_cb_bio(name, type) \
302
+ DECLARE_PEM_write_cb_fp(name, type)
303
+
304
+ #define DECLARE_PEM_read(name, type) \
305
+ DECLARE_PEM_read_bio(name, type) \
306
+ DECLARE_PEM_read_fp(name, type)
307
+
308
+ #define DECLARE_PEM_rw(name, type) \
309
+ DECLARE_PEM_read(name, type) \
310
+ DECLARE_PEM_write(name, type)
311
+
312
+ #define DECLARE_PEM_rw_const(name, type) \
313
+ DECLARE_PEM_read(name, type) \
314
+ DECLARE_PEM_write_const(name, type)
315
+
316
+ #define DECLARE_PEM_rw_cb(name, type) \
317
+ DECLARE_PEM_read(name, type) \
318
+ DECLARE_PEM_write_cb(name, type)
319
+
320
+ typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);
321
+
322
+ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
323
+ int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data, long *len,
324
+ pem_password_cb *callback, void *u);
325
+
326
+ #ifndef OPENSSL_NO_BIO
327
+ int PEM_read_bio(BIO *bp, char **name, char **header,
328
+ unsigned char **data, long *len);
329
+ int PEM_write_bio(BIO *bp, const char *name, const char *hdr,
330
+ const unsigned char *data, long len);
331
+ int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm,
332
+ const char *name, BIO *bp, pem_password_cb *cb, void *u);
333
+ void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
334
+ void **x, pem_password_cb *cb, void *u);
335
+ int PEM_ASN1_write_bio(i2d_of_void *i2d, const char *name, BIO *bp, void *x,
336
+ const EVP_CIPHER *enc, unsigned char *kstr, int klen,
337
+ pem_password_cb *cb, void *u);
338
+
339
+ STACK_OF(X509_INFO) * PEM_X509_INFO_read_bio(BIO *bp,
340
+ STACK_OF(X509_INFO) *sk, pem_password_cb *cb, void *u);
341
+ #endif
342
+
343
+ int PEM_read(FILE *fp, char **name, char **header,
344
+ unsigned char **data, long *len);
345
+ int PEM_write(FILE *fp, const char *name, const char *hdr,
346
+ const unsigned char *data, long len);
347
+ void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
348
+ pem_password_cb *cb, void *u);
349
+ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
350
+ void *x, const EVP_CIPHER *enc, unsigned char *kstr,
351
+ int klen, pem_password_cb *callback, void *u);
352
+
353
+ int PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
354
+ int PEM_SignUpdate(EVP_MD_CTX *ctx, unsigned char *d, unsigned int cnt);
355
+ int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
356
+ unsigned int *siglen, EVP_PKEY *pkey);
357
+
358
+ int PEM_def_callback(char *buf, int num, int w, void *key);
359
+ void PEM_proc_type(char *buf, int type);
360
+ void PEM_dek_info(char *buf, const char *type, int len, char *str);
361
+
362
+
363
+ DECLARE_PEM_rw(X509, X509)
364
+
365
+ DECLARE_PEM_rw(X509_AUX, X509)
366
+
367
+ DECLARE_PEM_rw(X509_REQ, X509_REQ)
368
+ DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
369
+
370
+ DECLARE_PEM_rw(X509_CRL, X509_CRL)
371
+
372
+ DECLARE_PEM_rw(PKCS7, PKCS7)
373
+
374
+ DECLARE_PEM_rw(PKCS8, X509_SIG)
375
+
376
+ DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
377
+
378
+ #ifndef OPENSSL_NO_RSA
379
+
380
+ DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
381
+
382
+ DECLARE_PEM_rw_const(RSAPublicKey, RSA)
383
+ DECLARE_PEM_rw(RSA_PUBKEY, RSA)
384
+
385
+ #endif
386
+
387
+ #ifndef OPENSSL_NO_DSA
388
+
389
+ DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
390
+
391
+ DECLARE_PEM_rw(DSA_PUBKEY, DSA)
392
+
393
+ DECLARE_PEM_rw_const(DSAparams, DSA)
394
+
395
+ #endif
396
+
397
+ #ifndef OPENSSL_NO_EC
398
+ DECLARE_PEM_rw_const(ECPKParameters, EC_GROUP)
399
+ DECLARE_PEM_rw_cb(ECPrivateKey, EC_KEY)
400
+ DECLARE_PEM_rw(EC_PUBKEY, EC_KEY)
401
+ #endif
402
+
403
+ #ifndef OPENSSL_NO_DH
404
+
405
+ DECLARE_PEM_rw_const(DHparams, DH)
406
+
407
+ #endif
408
+
409
+ DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
410
+
411
+ DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
412
+
413
+ int PEM_write_bio_PrivateKey_traditional(BIO *bp, EVP_PKEY *x,
414
+ const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb,
415
+ void *u);
416
+ int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
417
+ char *kstr, int klen,
418
+ pem_password_cb *cb, void *u);
419
+ int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
420
+ char *, int, pem_password_cb *, void *);
421
+ int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
422
+ char *kstr, int klen,
423
+ pem_password_cb *cb, void *u);
424
+ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
425
+ char *kstr, int klen,
426
+ pem_password_cb *cb, void *u);
427
+ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
428
+ void *u);
429
+
430
+ int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
431
+ char *kstr, int klen,
432
+ pem_password_cb *cb, void *u);
433
+ int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
434
+ char *kstr, int klen,
435
+ pem_password_cb *cb, void *u);
436
+ int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
437
+ char *kstr, int klen,
438
+ pem_password_cb *cb, void *u);
439
+
440
+ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
441
+ void *u);
442
+
443
+ int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
444
+ char *kstr, int klen, pem_password_cb *cd, void *u);
445
+
446
+ EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
447
+ int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
448
+
449
+
450
+ EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);
451
+ EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);
452
+ EVP_PKEY *b2i_PrivateKey_bio(BIO *in);
453
+ EVP_PKEY *b2i_PublicKey_bio(BIO *in);
454
+ int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);
455
+ int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);
456
+ #ifndef OPENSSL_NO_RC4
457
+ EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
458
+ int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel, pem_password_cb *cb,
459
+ void *u);
460
+ #endif
461
+
462
+
463
+ void ERR_load_PEM_strings(void);
464
+
465
+ /* Error codes for the PEM functions. */
466
+
467
+ /* Function codes. */
468
+ #define PEM_F_B2I_DSS 127
469
+ #define PEM_F_B2I_PVK_BIO 128
470
+ #define PEM_F_B2I_RSA 129
471
+ #define PEM_F_CHECK_BITLEN_DSA 130
472
+ #define PEM_F_CHECK_BITLEN_RSA 131
473
+ #define PEM_F_D2I_PKCS8PRIVATEKEY_BIO 120
474
+ #define PEM_F_D2I_PKCS8PRIVATEKEY_FP 121
475
+ #define PEM_F_DO_B2I 132
476
+ #define PEM_F_DO_B2I_BIO 133
477
+ #define PEM_F_DO_BLOB_HEADER 134
478
+ #define PEM_F_DO_PK8PKEY 126
479
+ #define PEM_F_DO_PK8PKEY_FP 125
480
+ #define PEM_F_DO_PVK_BODY 135
481
+ #define PEM_F_DO_PVK_HEADER 136
482
+ #define PEM_F_I2B_PVK 137
483
+ #define PEM_F_I2B_PVK_BIO 138
484
+ #define PEM_F_LOAD_IV 101
485
+ #define PEM_F_PEM_ASN1_READ 102
486
+ #define PEM_F_PEM_ASN1_READ_BIO 103
487
+ #define PEM_F_PEM_ASN1_WRITE 104
488
+ #define PEM_F_PEM_ASN1_WRITE_BIO 105
489
+ #define PEM_F_PEM_DEF_CALLBACK 100
490
+ #define PEM_F_PEM_DO_HEADER 106
491
+ #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY 118
492
+ #define PEM_F_PEM_GET_EVP_CIPHER_INFO 107
493
+ #define PEM_F_PEM_PK8PKEY 119
494
+ #define PEM_F_PEM_READ 108
495
+ #define PEM_F_PEM_READ_BIO 109
496
+ #define PEM_F_PEM_READ_BIO_PARAMETERS 140
497
+ #define PEM_F_PEM_READ_BIO_PRIVATEKEY 123
498
+ #define PEM_F_PEM_READ_PRIVATEKEY 124
499
+ #define PEM_F_PEM_SEALFINAL 110
500
+ #define PEM_F_PEM_SEALINIT 111
501
+ #define PEM_F_PEM_SIGNFINAL 112
502
+ #define PEM_F_PEM_WRITE 113
503
+ #define PEM_F_PEM_WRITE_BIO 114
504
+ #define PEM_F_PEM_WRITE_PRIVATEKEY 139
505
+ #define PEM_F_PEM_X509_INFO_READ 115
506
+ #define PEM_F_PEM_X509_INFO_READ_BIO 116
507
+ #define PEM_F_PEM_X509_INFO_WRITE_BIO 117
508
+
509
+ /* Reason codes. */
510
+ #define PEM_R_BAD_BASE64_DECODE 100
511
+ #define PEM_R_BAD_DECRYPT 101
512
+ #define PEM_R_BAD_END_LINE 102
513
+ #define PEM_R_BAD_IV_CHARS 103
514
+ #define PEM_R_BAD_MAGIC_NUMBER 116
515
+ #define PEM_R_BAD_PASSWORD_READ 104
516
+ #define PEM_R_BAD_VERSION_NUMBER 117
517
+ #define PEM_R_BIO_WRITE_FAILURE 118
518
+ #define PEM_R_CIPHER_IS_NULL 127
519
+ #define PEM_R_ERROR_CONVERTING_PRIVATE_KEY 115
520
+ #define PEM_R_EXPECTING_PRIVATE_KEY_BLOB 119
521
+ #define PEM_R_EXPECTING_PUBLIC_KEY_BLOB 120
522
+ #define PEM_R_INCONSISTENT_HEADER 121
523
+ #define PEM_R_KEYBLOB_HEADER_PARSE_ERROR 122
524
+ #define PEM_R_KEYBLOB_TOO_SHORT 123
525
+ #define PEM_R_NOT_DEK_INFO 105
526
+ #define PEM_R_NOT_ENCRYPTED 106
527
+ #define PEM_R_NOT_PROC_TYPE 107
528
+ #define PEM_R_NO_START_LINE 108
529
+ #define PEM_R_PROBLEMS_GETTING_PASSWORD 109
530
+ #define PEM_R_PUBLIC_KEY_NO_RSA 110
531
+ #define PEM_R_PVK_DATA_TOO_SHORT 124
532
+ #define PEM_R_PVK_TOO_SHORT 125
533
+ #define PEM_R_READ_KEY 111
534
+ #define PEM_R_SHORT_HEADER 112
535
+ #define PEM_R_UNSUPPORTED_CIPHER 113
536
+ #define PEM_R_UNSUPPORTED_ENCRYPTION 114
537
+ #define PEM_R_UNSUPPORTED_KEY_COMPONENTS 126
538
+
539
+ #ifdef __cplusplus
540
+ }
541
+ #endif
542
+ #endif