return 0;
}
+/* Store a 16 byte AES key.
+ *
+ * copy 16 bytes from key to cfg->ykcore_config.key
+ */
+int ykp_AES_key_from_raw(YKP_CONFIG *cfg, const char *key) {
+ memcpy(cfg->ykcore_config.key, key, sizeof(cfg->ykcore_config.key));
+ return 0;
+}
+
+/* Store a 20 byte HMAC key.
+ *
+ * store the first 16 bytes of key in cfg->ykcore_config.key
+ * and the remaining 4 bytes in cfg->ykcore_config.uid
+ */
+int ykp_HMAC_key_from_raw(YKP_CONFIG *cfg, const char *key) {
+ size_t size = sizeof(cfg->ykcore_config.key);
+ memcpy(cfg->ykcore_config.key, key, size);
+ memcpy(cfg->ykcore_config.uid, key + size, 20 - size);
+ return 0;
+}
+
/* Decode 160 bits HMAC key, used with OATH and HMAC challenge-response.
*
* The first 128 bits of the HMAC go key into cfg->ykcore_config.key,
int ykp_configure_for(YKP_CONFIG *cfg, int confnum, YK_STATUS *st);
int ykp_AES_key_from_hex(YKP_CONFIG *cfg, const char *hexkey);
+int ykp_AES_key_from_raw(YKP_CONFIG *cfg, const char *key);
int ykp_AES_key_from_passphrase(YKP_CONFIG *cfg, const char *passphrase,
const char *salt);
int ykp_HMAC_key_from_hex(YKP_CONFIG *cfg, const char *hexkey);
+int ykp_HMAC_key_from_raw(YKP_CONFIG *cfg, const char *key);
/* Functions for constructing the YK_NDEF struct before writing it to a neo */
YK_NDEF *ykp_alloc_ndef(void);