aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_pkey.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2005-05-15 00:54:45 +0000
committerDr. Stephen Henson <steve@openssl.org>2005-05-15 00:54:45 +0000
commitb6995add5c91e9d62812883d884f0c558e6235d3 (patch)
treede05b05031f2ddd4848598a1e8e33e0aa3021c06 /crypto/evp/evp_pkey.c
parent8ccd06c66c948916a5a3984087860e297f49051d (diff)
downloadopenssl-b6995add5c91e9d62812883d884f0c558e6235d3.tar.gz
Make -CSP option work again in pkcs12 utility by checking for
attribute in EVP_PKEY structure.
Diffstat (limited to 'crypto/evp/evp_pkey.c')
-rw-r--r--crypto/evp/evp_pkey.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/crypto/evp/evp_pkey.c b/crypto/evp/evp_pkey.c
index 925e0e0681..6510ed54dc 100644
--- a/crypto/evp/evp_pkey.c
+++ b/crypto/evp/evp_pkey.c
@@ -709,3 +709,65 @@ static int eckey_pkey2pkcs8(PKCS8_PRIV_KEY_INFO *p8, EVP_PKEY *pkey)
return ret;
}
#endif
+
+/* EVP_PKEY attribute functions */
+
+int EVP_PKEY_get_attr_count(const EVP_PKEY *key)
+{
+ return X509at_get_attr_count(key->attributes);
+}
+
+int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,
+ int lastpos)
+{
+ return X509at_get_attr_by_NID(key->attributes, nid, lastpos);
+}
+
+int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
+ int lastpos)
+{
+ return X509at_get_attr_by_OBJ(key->attributes, obj, lastpos);
+}
+
+X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc)
+{
+ return X509at_get_attr(key->attributes, loc);
+}
+
+X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc)
+{
+ return X509at_delete_attr(key->attributes, loc);
+}
+
+int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr)
+{
+ if(X509at_add1_attr(&key->attributes, attr)) return 1;
+ return 0;
+}
+
+int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
+ const ASN1_OBJECT *obj, int type,
+ const unsigned char *bytes, int len)
+{
+ if(X509at_add1_attr_by_OBJ(&key->attributes, obj,
+ type, bytes, len)) return 1;
+ return 0;
+}
+
+int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
+ int nid, int type,
+ const unsigned char *bytes, int len)
+{
+ if(X509at_add1_attr_by_NID(&key->attributes, nid,
+ type, bytes, len)) return 1;
+ return 0;
+}
+
+int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
+ const char *attrname, int type,
+ const unsigned char *bytes, int len)
+{
+ if(X509at_add1_attr_by_txt(&key->attributes, attrname,
+ type, bytes, len)) return 1;
+ return 0;
+}