More tests

This commit is contained in:
Zhi Guan
2022-03-21 13:11:41 +08:00
parent ad1a4d66f9
commit 5ea884ce8f
50 changed files with 3319 additions and 1040 deletions

View File

@@ -63,7 +63,7 @@ extern "C" {
#endif
/*
curve:
NamedCurve:
OID_sm2
OID_prime192v1
OID_prime256v1
@@ -71,13 +71,30 @@ curve:
OID_secp384r1
OID_secp521r1
*/
const char *ec_curve_name(int curve);
int ec_curve_from_name(const char *name);
const char *ec_named_curve_name(int curve);
int ec_named_curve_from_name(const char *name);
int ec_named_curve_to_der(int curve, uint8_t **out, size_t *outlen);
int ec_named_curve_from_der(int *curve, const uint8_t **in, size_t *inlen);
int ec_public_key_algor_to_der(int curve, uint8_t **out, size_t *outlen);
int ec_public_key_algor_from_der(int *curve, const uint8_t **in, size_t *inlen);
int ec_public_key_algor_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen);
/*
ECPoint ::= OCTET STRING -- uncompressed point
*/
int ec_point_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen);
/*
ECPrivateKey ::= SEQUENCE {
version INTEGER, -- value MUST be (1)
privateKey OCTET STRING, -- big endian encoding of integer
parameters [0] EXPLICIT OBJECT IDENTIFIER OPTIONAL, -- namedCurve
publicKey [1] EXPLICIT BIT STRING OPTIONAL -- ECPoint
}
*/
enum {
EC_private_key_version = 1,
};
int ec_private_key_print(FILE *fp, int fmt, int ind, const char *label, const uint8_t *d, size_t dlen);
#ifdef __cplusplus
}