aboutsummaryrefslogtreecommitdiff
path: root/asn1_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'asn1_internal.h')
-rw-r--r--asn1_internal.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/asn1_internal.h b/asn1_internal.h
index 0b08b84..fe2f293 100644
--- a/asn1_internal.h
+++ b/asn1_internal.h
@@ -89,6 +89,23 @@ static inline uint8_t *unconst_uint8_t(const uint8_t * const arg)
return (uint8_t *) arg;
}
+/*
+ * OIDs.
+ */
+
+extern const uint8_t hal_asn1_oid_rsaEncryption[];
+extern const size_t hal_asn1_oid_rsaEncryption_len;
+
+extern const uint8_t hal_asn1_oid_ecPublicKey[];
+extern const size_t hal_asn1_oid_ecPublicKey_len;
+
+extern const uint8_t hal_asn1_oid_aesKeyWrap[];
+extern const size_t hal_asn1_oid_aesKeyWrap_len;
+
+/*
+ * Transcoding functions.
+ */
+
extern hal_error_t hal_asn1_encode_header(const uint8_t tag,
const size_t value_len,
uint8_t *der, size_t *der_len, const size_t der_max);
@@ -113,6 +130,27 @@ extern hal_error_t hal_asn1_decode_spki(const uint8_t **alg_oid, size_t *alg_o
const uint8_t **pubkey, size_t *pubkey_len,
const uint8_t *const der, const size_t der_len);
+extern hal_error_t hal_asn1_encode_pkcs8_privatekeyinfo(const uint8_t * const alg_oid, const size_t alg_oid_len,
+ const uint8_t * const curve_oid, const size_t curve_oid_len,
+ const uint8_t * const privkey, const size_t privkey_len,
+ uint8_t *der, size_t *der_len, const size_t der_max);
+
+extern hal_error_t hal_asn1_decode_pkcs8_privatekeyinfo(const uint8_t **alg_oid, size_t *alg_oid_len,
+ const uint8_t **curve_oid, size_t *curve_oid_len,
+ const uint8_t **privkey, size_t *privkey_len,
+ const uint8_t *const der, const size_t der_len);
+
+extern hal_error_t hal_asn1_encode_pkcs8_encryptedprivatekeyinfo(const uint8_t * const alg_oid, const size_t alg_oid_len,
+ const uint8_t * const data, const size_t data_len,
+ uint8_t *der, size_t *der_len, const size_t der_max);
+
+extern hal_error_t hal_asn1_decode_pkcs8_encryptedprivatekeyinfo(const uint8_t **alg_oid, size_t *alg_oid_len,
+ const uint8_t **data, size_t *data_len,
+ const uint8_t *const der, const size_t der_len);
+
+extern hal_error_t hal_asn1_guess_key_type(hal_key_type_t *type, hal_curve_name_t *curve,
+ const uint8_t *const der, const size_t der_len);
+
#endif /* _HAL_ASN1_INTERNAL_H_ */
/*