Add algorithm specific signature printing. An individual ASN1 method can
[openssl.git] / crypto / x509 / x509.h
index a3a7c441b3e723a412727f1aba896b68a0d5a3c0..9fbb0c809d2463384ae7ffc95429c28ba6fbc980 100644 (file)
@@ -116,6 +116,7 @@ extern "C" {
 /* Under Win32 these are defined in wincrypt.h */
 #undef X509_NAME
 #undef X509_CERT_PAIR
+#undef X509_EXTENSIONS
 #endif
 
 #define X509_FILETYPE_PEM      1
@@ -146,9 +147,10 @@ struct X509_algor_st
        ASN1_TYPE *parameter;
        } /* X509_ALGOR */;
 
-DECLARE_STACK_OF(X509_ALGOR)
 DECLARE_ASN1_SET_OF(X509_ALGOR)
 
+typedef STACK_OF(X509_ALGOR) X509_ALGORS;
+
 typedef struct X509_val_st
        {
        ASN1_TIME *notBefore;
@@ -293,6 +295,8 @@ struct x509_st
        AUTHORITY_KEYID *akid;
        X509_POLICY_CACHE *policy_cache;
        STACK_OF(DIST_POINT) *crldp;
+       STACK_OF(GENERAL_NAME) *altname;
+       NAME_CONSTRAINTS *nc;
 #ifndef OPENSSL_NO_RFC3779
        STACK_OF(IPAddressFamily) *rfc3779_addr;
        struct ASIdentifiers_st *rfc3779_asid;
@@ -431,6 +435,10 @@ struct x509_revoked_st
        ASN1_INTEGER *serialNumber;
        ASN1_TIME *revocationDate;
        STACK_OF(X509_EXTENSION) /* optional */ *extensions;
+       /* Set up if indirect CRL */
+       STACK_OF(GENERAL_NAME) *issuer;
+       /* Revocation reason */
+       int reason;
        int sequence; /* load sequence */
        };
 
@@ -463,9 +471,13 @@ struct X509_crl_st
        /* Convenient breakdown of IDP */
        int idp_flags;
        int idp_reasons;
+       /* CRL and base CRL numbers for delta processing */
+       ASN1_INTEGER *crl_number;
+       ASN1_INTEGER *base_crl_number;
 #ifndef OPENSSL_NO_SHA
        unsigned char sha1_hash[SHA_DIGEST_LENGTH];
 #endif
+       STACK_OF(GENERAL_NAMES) *issuers;
        const X509_CRL_METHOD *meth;
        void *meth_data;
        } /* X509_CRL */;
@@ -573,6 +585,7 @@ struct pkcs8_priv_key_info_st
 #define PKCS8_NO_OCTET         1
 #define PKCS8_EMBEDDED_PARAM   2
 #define PKCS8_NS_DB            3
+#define PKCS8_NEG_PRIVKEY      4
         ASN1_INTEGER *version;
         X509_ALGOR *pkeyalg;
         ASN1_TYPE *pkey; /* Should be OCTET STRING but some are broken */
@@ -614,7 +627,8 @@ void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
 X509_CRL_METHOD *X509_CRL_METHOD_new(
        int (*crl_init)(X509_CRL *crl),
        int (*crl_free)(X509_CRL *crl),
-       int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret, ASN1_INTEGER *ser),
+       int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
+                               ASN1_INTEGER *ser, X509_NAME *issuer),
        int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk));
 void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
 
@@ -642,6 +656,7 @@ int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
 
 int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
 
+int X509_signature_dump(BIO *bp,const ASN1_STRING *sig, int indent);
 int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig);
 
 int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
@@ -755,6 +770,8 @@ X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
 int            X509_cmp_time(const ASN1_TIME *s, time_t *t);
 int            X509_cmp_current_time(const ASN1_TIME *s);
 ASN1_TIME *    X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
+ASN1_TIME *    X509_time_adj_ex(ASN1_TIME *s,
+                               int offset_day, long offset_sec, time_t *t);
 ASN1_TIME *    X509_gmtime_adj(ASN1_TIME *s, long adj);
 
 const char *   X509_get_default_cert_area(void );
@@ -768,6 +785,7 @@ 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);
 
 DECLARE_ASN1_FUNCTIONS(X509_ALGOR)
+DECLARE_ASN1_ENCODE_FUNCTIONS(X509_ALGORS, X509_ALGORS, X509_ALGORS)
 DECLARE_ASN1_FUNCTIONS(X509_VAL)
 
 DECLARE_ASN1_FUNCTIONS(X509_PUBKEY)
@@ -843,6 +861,7 @@ DECLARE_ASN1_FUNCTIONS(X509_CRL)
 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
 int X509_CRL_get0_by_serial(X509_CRL *crl,
                X509_REVOKED **ret, ASN1_INTEGER *serial);
+int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
 
 X509_PKEY *    X509_PKEY_new(void );
 void           X509_PKEY_free(X509_PKEY *a);
@@ -944,9 +963,15 @@ unsigned long      X509_issuer_name_hash(X509 *a);
 int            X509_subject_name_cmp(const X509 *a, const X509 *b);
 unsigned long  X509_subject_name_hash(X509 *x);
 
+#ifndef OPENSSL_NO_MD5
+unsigned long  X509_issuer_name_hash_old(X509 *a);
+unsigned long  X509_subject_name_hash_old(X509 *x);
+#endif
+
 int            X509_cmp(const X509 *a, const X509 *b);
 int            X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
 unsigned long  X509_NAME_hash(X509_NAME *x);
+unsigned long  X509_NAME_hash_old(X509_NAME *x);
 
 int            X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
 int            X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
@@ -1125,13 +1150,20 @@ DECLARE_ASN1_FUNCTIONS(PBEPARAM)
 DECLARE_ASN1_FUNCTIONS(PBE2PARAM)
 DECLARE_ASN1_FUNCTIONS(PBKDF2PARAM)
 
-X509_ALGOR *PKCS5_pbe_set(int alg, int iter, unsigned char *salt, int saltlen);
+int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
+                               const unsigned char *salt, int saltlen);
+
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
+                               const unsigned char *salt, int saltlen);
 X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
                                         unsigned char *salt, int saltlen);
 X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
                                 unsigned char *salt, int saltlen,
                                 unsigned char *aiv, int prf_nid);
 
+X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
+                               int prf_nid, int keylen);
+
 /* PKCS#8 utilities */
 
 DECLARE_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)