Make -nameopt work in req and add support for -reqopt
[openssl.git] / crypto / x509 / x509.h
index 0597bb4d003a75efe544809540c32e7f902cd7eb..96d3b6988892c1cd79cb28da8f15d323ae0978fc 100644 (file)
  * copied and put under another distribution licence
  * [including the GNU Public Licence.]
  */
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECDH support in OpenSSL originally developed by 
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
 
 #ifndef HEADER_X509_H
 #define HEADER_X509_H
 #include <openssl/dsa.h>
 #endif
 
+#ifndef OPENSSL_NO_EC
+#include <openssl/ec.h>
+#endif
+
+#ifndef OPENSSL_NO_ECDSA
+#include <openssl/ecdsa.h>
+#endif
+
+#ifndef OPENSSL_NO_ECDH
+#include <openssl/ecdh.h>
+#endif
+
 #ifndef OPENSSL_NO_DH
 #include <openssl/dh.h>
 #endif
 #endif
 #include <openssl/evp.h>
 #include <openssl/e_os2.h>
-#include <openssl/types.h>
+#include <openssl/ossl_typ.h>
 
 #ifdef  __cplusplus
 extern "C" {
@@ -126,7 +143,7 @@ struct X509_algor_st
        {
        ASN1_OBJECT *algorithm;
        ASN1_TYPE *parameter;
-       };
+       } /* X509_ALGOR */;
 
 DECLARE_STACK_OF(X509_ALGOR)
 DECLARE_ASN1_SET_OF(X509_ALGOR)
@@ -172,7 +189,7 @@ struct X509_name_st
        char *bytes;
 #endif
        unsigned long hash; /* Keep the hash around for lookups */
-       };
+       } /* X509_NAME */;
 
 DECLARE_STACK_OF(X509_NAME)
 
@@ -272,7 +289,7 @@ struct x509_st
        unsigned char sha1_hash[SHA_DIGEST_LENGTH];
 #endif
        X509_CERT_AUX *aux;
-       };
+       } /* X509 */;
 
 DECLARE_STACK_OF(X509)
 DECLARE_ASN1_SET_OF(X509)
@@ -331,6 +348,7 @@ DECLARE_STACK_OF(X509_TRUST)
 #define        X509_FLAG_NO_EXTENSIONS         (1L << 8)
 #define        X509_FLAG_NO_SIGDUMP            (1L << 9)
 #define        X509_FLAG_NO_AUX                (1L << 10)
+#define        X509_FLAG_NO_ATTRIBUTES         (1L << 11)
 
 /* Flags specific to X509_NAME_print_ex() */   
 
@@ -419,7 +437,7 @@ struct X509_crl_st
        X509_ALGOR *sig_alg;
        ASN1_BIT_STRING *signature;
        int references;
-       };
+       } /* X509_CRL */;
 
 DECLARE_STACK_OF(X509_CRL)
 DECLARE_ASN1_SET_OF(X509_CRL)
@@ -652,6 +670,17 @@ extern "C" {
 #define i2d_DSAPrivateKey_bio(bp,dsa) ASN1_i2d_bio(i2d_DSAPrivateKey,bp, \
                (unsigned char *)dsa)
 
+#define d2i_ECPrivateKey_fp(fp,ecdsa) (EC_KEY *)ASN1_d2i_fp((char *(*)())\
+               EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (fp), \
+               (unsigned char **)(ecdsa))
+#define i2d_ECPrivateKey_fp(fp,ecdsa) ASN1_i2d_fp(i2d_ECPrivateKey,fp, \
+               (unsigned char *)ecdsa)
+#define d2i_ECPrivateKey_bio(bp,ecdsa) (EC_KEY *)ASN1_d2i_bio((char *(*)())\
+               EC_KEY_new,(char *(*)())d2i_ECPrivateKey, (bp), \
+               (unsigned char **)(ecdsa))
+#define i2d_ECPrivateKey_bio(bp,ecdsa) ASN1_i2d_bio(i2d_ECPrivateKey,bp, \
+               (unsigned char *)ecdsa)
+
 #define X509_ALGOR_dup(xn) (X509_ALGOR *)ASN1_dup((int (*)())i2d_X509_ALGOR,\
                (char *(*)())d2i_X509_ALGOR,(char *)xn)
 
@@ -755,6 +784,12 @@ int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);
 DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
 int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);
 #endif
+#ifndef OPENSSL_NO_EC
+EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
+int   i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);
+EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
+int   i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
+#endif
 X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8);
 int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8);
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
@@ -788,6 +823,12 @@ int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);
 DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
 int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);
 #endif
+#ifndef OPENSSL_NO_EC
+EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
+int   i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);
+EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
+int   i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
+#endif
 X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8);
 int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8);
 PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
@@ -829,7 +870,6 @@ const char *        X509_get_default_private_dir(void );
 
 X509_REQ *     X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
 X509 *         X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);
-void ERR_load_X509_strings(void );
 
 DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
 DECLARE_ASN1_FUNCTIONS(X509_VAL)
@@ -853,6 +893,11 @@ int                i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
 DSA *          d2i_DSA_PUBKEY(DSA **a,unsigned char **pp,
                        long length);
 #endif
+#ifndef OPENSSL_NO_EC
+int            i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
+EC_KEY                 *d2i_EC_PUBKEY(EC_KEY **a, unsigned char **pp,
+                       long length);
+#endif
 
 DECLARE_ASN1_FUNCTIONS(X509_SIG)
 DECLARE_ASN1_FUNCTIONS(X509_REQ_INFO)
@@ -975,6 +1020,15 @@ int X509_REQ_add1_attr_by_txt(X509_REQ *req,
                        const char *attrname, int type,
                        const unsigned char *bytes, int len);
 
+int X509_CRL_set_version(X509_CRL *x, long version);
+int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
+int X509_CRL_set_lastUpdate(X509_CRL *x, ASN1_TIME *tm);
+int X509_CRL_set_nextUpdate(X509_CRL *x, ASN1_TIME *tm);
+int X509_CRL_sort(X509_CRL *crl);
+
+int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
+int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
+
 int            X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
 
 int            X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
@@ -1007,6 +1061,7 @@ int               X509_print(BIO *bp,X509 *x);
 int            X509_ocspid_print(BIO *bp,X509 *x);
 int            X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);
 int            X509_CRL_print(BIO *bp,X509_CRL *x);
+int            X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag);
 int            X509_REQ_print(BIO *bp,X509_REQ *req);
 #endif
 
@@ -1212,6 +1267,8 @@ void ERR_load_X509_strings(void);
 #define X509_F_X509_REQ_TO_X509                                 123
 #define X509_F_X509_STORE_ADD_CERT                      124
 #define X509_F_X509_STORE_ADD_CRL                       125
+#define X509_F_X509_STORE_CTX_INIT                      143
+#define X509_F_X509_STORE_CTX_NEW                       142
 #define X509_F_X509_STORE_CTX_PURPOSE_INHERIT           134
 #define X509_F_X509_TO_X509_REQ                                 126
 #define X509_F_X509_TRUST_ADD                           133