Initial support for pluggable public key ASN1 support. Process most public
[openssl.git] / crypto / asn1 / asn1.h
index 9f6e1b99b3f5640df90a648ed84edc2ec7db53a6..32653eb1f0dc918e516bbf95575f8b4c53a9a894 100644 (file)
@@ -282,6 +282,26 @@ typedef struct ASN1_TLC_st ASN1_TLC;
 /* This is just an opaque pointer */
 typedef struct ASN1_VALUE_st ASN1_VALUE;
 
+/* ASN1 public key method structure */
+
+#define ASN1_PKEY_ALIAS                0x1
+
+struct evp_pkey_asn1_method_st
+       {
+       int pkey_id;
+       int pkey_base_id;
+       unsigned long pkey_flags;
+       int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub);
+       int (*pub_encode)(X509_PUBKEY *pub, EVP_PKEY *pk);
+       int (*pub_print)(BIO *out, EVP_PKEY *pkey, int indent, ASN1_PCTX *pctx);
+       int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf);
+       int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pk);
+       int (*priv_print)(BIO *out, EVP_PKEY *pkey, int indent,
+                                                       ASN1_PCTX *pctx);
+       void (*pkey_free)(EVP_PKEY *pkey);
+       void (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
+       } /* EVP_PKEY_ASN1_METHOD */;
+
 /* Declare ASN1 functions: the implement macro in in asn1t.h */
 
 #define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
@@ -940,10 +960,10 @@ int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
 #define ASN1_i2d_bio_of_const(type,i2d,out,x) \
        ((int (*)(I2D_OF_const(type),BIO *,const type *))openssl_fcast(ASN1_i2d_bio))(i2d,out,x)
 int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
-int ASN1_UTCTIME_print(BIO *fp,ASN1_UTCTIME *a);
-int ASN1_GENERALIZEDTIME_print(BIO *fp,ASN1_GENERALIZEDTIME *a);
-int ASN1_TIME_print(BIO *fp,ASN1_TIME *a);
-int ASN1_STRING_print(BIO *bp,ASN1_STRING *v);
+int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
+int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
+int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
+int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
 int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
 int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
 int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);