1# Exporting a Key (ArkTS) 2 3 4This topic walks you through on how to export the public key of a persistently stored asymmetric key. Currently, HUKS supports export of the ECC, RSA, Ed25519, X25519, and SM2 public keys. 5>**NOTE**<br> 6> The mini-system devices support export of only the RSA public keys. 7 8 9## How to Develop 10 111. Set the key alias (**keyAlias**), which cannot exceed 128 bytes. 12 132. Use [exportKeyItem](../../reference/apis-universal-keystore-kit/js-apis-huks.md#huksexportkeyitem9) to export the key based on the specified **keyAlias** and **options**. 14 **options** is a reserved parameter and is left empty currently. 15 163. In the [HuksReturnResult](../../reference/apis-universal-keystore-kit/js-apis-huks.md#huksreturnresult9) object returned, the public key is in the **outData** field in the DER format defined in X.509. For details about the format, see [Public Key Material Format](huks-concepts.md#public-key-material-format). 17 18```ts 19import { huks } from '@kit.UniversalKeystoreKit'; 20 21/* 1. Set the key alias. */ 22let keyAlias = 'keyAlias'; 23/* Leave options empty. */ 24let emptyOptions: huks.HuksOptions = { 25 properties: [] 26}; 27try { 28 /* 2. Export the key. */ 29 huks.exportKeyItem(keyAlias, emptyOptions, (error, data) => { 30 if (error) { 31 console.error(`callback: exportKeyItem failed, ` + error); 32 } else { 33 console.info(`callback: exportKeyItem success, data = ${JSON.stringify(data)}`); 34 } 35 }); 36} catch (error) { 37 console.error(`callback: exportKeyItem input arg invalid, ` + JSON.stringify(error)); 38} 39``` 40