aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-07-26 08:41:04 +0000
committerBodo Möller <bodo@openssl.org>2002-07-26 08:41:04 +0000
commit0bee0e6294882b18ffa0053597532058a19d6f89 (patch)
tree210c9fd5126e875e14b59945dc7829d0abb81566 /crypto/ec
parent12593e6f45b146ac8f368e743238f67f22a52c80 (diff)
downloadopenssl-0bee0e6294882b18ffa0053597532058a19d6f89.tar.gz
Use SEC1 format for EC private keys.
This is not ECDSA specific, so it's now PEM_STRING_ECPRIVATEKEY etc. Submitted by: Nils Larsch <nlarsch@compuserve.de>
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec.h12
-rw-r--r--crypto/ec/ec_asn1.c12
2 files changed, 22 insertions, 2 deletions
diff --git a/crypto/ec/ec.h b/crypto/ec/ec.h
index e17fc20dd4..55f9cabd03 100644
--- a/crypto/ec/ec.h
+++ b/crypto/ec/ec.h
@@ -275,6 +275,18 @@ int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
#endif
+/* SEC1 ECPrivateKey */
+typedef struct ec_privatekey_st {
+ int version;
+ ASN1_OCTET_STRING *privateKey;
+ ECPKPARAMETERS *parameters;
+ ASN1_BIT_STRING *publicKey;
+ } EC_PRIVATEKEY;
+
+DECLARE_ASN1_ITEM(EC_PRIVATEKEY)
+DECLARE_ASN1_FUNCTIONS_const(EC_PRIVATEKEY)
+DECLARE_ASN1_ENCODE_FUNCTIONS_const(EC_PRIVATEKEY, EC_PRIVATEKEY)
+
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index 009896b558..90b64b0e04 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -53,9 +53,8 @@
*
*/
-#include "cryptlib.h"
#include "ec_lcl.h"
-#include <openssl/asn1.h>
+#include <openssl/err.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
@@ -163,6 +162,15 @@ ASN1_CHOICE(ECPKPARAMETERS) = {
DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
+ASN1_SEQUENCE(EC_PRIVATEKEY) = {
+ ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),
+ ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
+ ASN1_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS),
+ ASN1_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING)
+} ASN1_SEQUENCE_END(EC_PRIVATEKEY)
+
+IMPLEMENT_ASN1_FUNCTIONS_const(EC_PRIVATEKEY)
+
/* some internal functions */
static X9_62_FIELDID *ec_asn1_group2field(const EC_GROUP *, X9_62_FIELDID *);