Loops like this one:
[openssl.git] / crypto / pem / pem.h
index fc333e42c8ae844179e5cd7bc924ea4e43059881..6d3c446577f0067ad4bcf35f73cae1b855745419 100644 (file)
 #ifndef HEADER_PEM_H
 #define HEADER_PEM_H
 
-#ifdef  __cplusplus
-extern "C" {
+#ifndef NO_BIO
+#include <openssl/bio.h>
+#endif
+#ifndef NO_STACK
+#include <openssl/stack.h>
 #endif
-
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 #include <openssl/pem2.h>
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 #define PEM_BUFSIZE            1024
 
 #define PEM_OBJ_UNDEF          0
@@ -103,13 +109,16 @@ extern "C" {
 
 #define PEM_STRING_X509_OLD    "X509 CERTIFICATE"
 #define PEM_STRING_X509                "CERTIFICATE"
+#define PEM_STRING_X509_TRUSTED        "TRUSTED CERTIFICATE"
 #define PEM_STRING_X509_REQ_OLD        "NEW CERTIFICATE REQUEST"
 #define PEM_STRING_X509_REQ    "CERTIFICATE REQUEST"
 #define PEM_STRING_X509_CRL    "X509 CRL"
 #define PEM_STRING_EVP_PKEY    "ANY PRIVATE KEY"
+#define PEM_STRING_PUBLIC      "PUBLIC KEY"
 #define PEM_STRING_RSA         "RSA PRIVATE KEY"
 #define PEM_STRING_RSA_PUBLIC  "RSA PUBLIC KEY"
 #define PEM_STRING_DSA         "DSA PRIVATE KEY"
+#define PEM_STRING_DSA_PUBLIC  "DSA PUBLIC KEY"
 #define PEM_STRING_PKCS7       "PKCS7"
 #define PEM_STRING_PKCS8       "ENCRYPTED PRIVATE KEY"
 #define PEM_STRING_PKCS8INF    "PRIVATE KEY"
@@ -162,7 +171,7 @@ typedef struct pem_ctx_st
        int num_recipient;
        PEM_USER **recipient;
 
-#ifdef HEADER_STACK_H
+#ifndef NO_STACK
        STACK *x509_chain;      /* certificate chain */
 #else
        char *x509_chain;       /* certificate chain */
@@ -286,7 +295,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
 
 #endif
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 #define DECLARE_PEM_read_bio(name, type) \
        type *PEM_read_bio_##name(BIO *bp, type **x, pem_password_cb *cb, void *u);
 
@@ -474,7 +483,7 @@ int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
 int    PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,
        pem_password_cb *callback,void *u);
 
-#ifdef HEADER_BIO_H
+#ifndef NO_BIO
 int    PEM_read_bio(BIO *bp, char **name, char **header,
                unsigned char **data,long *len);
 int    PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
@@ -522,13 +531,14 @@ void      PEM_dek_info(char *buf, const char *type, int len, char *str);
 
 #ifndef SSLEAY_MACROS
 
-#ifdef VMS
-#include <openssl/vms_idhacks.h>
-#endif
+#include <openssl/symhacks.h>
 
 DECLARE_PEM_rw(X509, X509)
 
+DECLARE_PEM_rw(X509_AUX, X509)
+
 DECLARE_PEM_rw(X509_REQ, X509_REQ)
+DECLARE_PEM_write(X509_REQ_NEW, X509_REQ)
 
 DECLARE_PEM_rw(X509_CRL, X509_CRL)
 
@@ -545,6 +555,7 @@ DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
 DECLARE_PEM_rw_cb(RSAPrivateKey, RSA)
 
 DECLARE_PEM_rw(RSAPublicKey, RSA)
+DECLARE_PEM_rw(RSA_PUBKEY, RSA)
 
 #endif
 
@@ -552,6 +563,8 @@ DECLARE_PEM_rw(RSAPublicKey, RSA)
 
 DECLARE_PEM_rw_cb(DSAPrivateKey, DSA)
 
+DECLARE_PEM_rw(DSA_PUBKEY, DSA)
+
 DECLARE_PEM_rw(DSAparams, DSA)
 
 #endif
@@ -564,10 +577,36 @@ DECLARE_PEM_rw(DHparams, DH)
 
 DECLARE_PEM_rw_cb(PrivateKey, EVP_PKEY)
 
+DECLARE_PEM_rw(PUBKEY, EVP_PKEY)
+
+int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
+                                 char *kstr, int klen,
+                                 pem_password_cb *cb, void *u);
 int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
                                   char *, int, pem_password_cb *, void *);
+int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
+                                 char *kstr, int klen,
+                                 pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
+                                 char *kstr, int klen,
+                                 pem_password_cb *cb, void *u);
+EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
+
+int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
+                                 char *kstr, int klen,
+                                 pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
+                                 char *kstr, int klen,
+                                 pem_password_cb *cb, void *u);
+int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
+                                 char *kstr, int klen,
+                                 pem_password_cb *cb, void *u);
+
+EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
+
 int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
                              char *kstr,int klen, pem_password_cb *cd, void *u);
+
 #endif /* SSLEAY_MACROS */
 
 
@@ -579,6 +618,8 @@ int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
 /* Error codes for the PEM functions. */
 
 /* Function codes. */
+#define PEM_F_D2I_PKCS8PRIVATEKEY_BIO                   120
+#define PEM_F_D2I_PKCS8PRIVATEKEY_FP                    121
 #define PEM_F_DEF_CALLBACK                              100
 #define PEM_F_LOAD_IV                                   101
 #define PEM_F_PEM_ASN1_READ                             102
@@ -586,6 +627,7 @@ int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
 #define PEM_F_PEM_ASN1_WRITE                            104
 #define PEM_F_PEM_ASN1_WRITE_BIO                        105
 #define PEM_F_PEM_DO_HEADER                             106
+#define PEM_F_PEM_F_DO_PK8KEY_FP                        122
 #define PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY           118
 #define PEM_F_PEM_GET_EVP_CIPHER_INFO                   107
 #define PEM_F_PEM_READ                                  108