1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 #include "tomcrypt_private.h"
4
5 /**
6 @file ed25519_import_pkcs8.c
7 Import an Ed25519 key in PKCS#8 format, Steffen Jaeckel
8 */
9
10 #ifdef LTC_CURVE25519
11
12 /**
13 Import an Ed25519 private key in PKCS#8 format
14 @param in The DER-encoded PKCS#8-formatted private key
15 @param inlen The length of the input data
16 @param passwd The password to decrypt the private key
17 @param passwdlen Password's length (octets)
18 @param key [out] Where to import the key to
19 @return CRYPT_OK if successful, on error all allocated memory is freed automatically
20 */
ed25519_import_pkcs8(const unsigned char * in,unsigned long inlen,const void * pwd,unsigned long pwdlen,curve25519_key * key)21 int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen,
22 const void *pwd, unsigned long pwdlen,
23 curve25519_key *key)
24 {
25 return ec25519_import_pkcs8(in, inlen, pwd, pwdlen, LTC_OID_ED25519, tweetnacl_crypto_sk_to_pk, key);
26 }
27
28 #endif
29