/* Extract the data for the public key algorithm  */
int x509_extract_key_data(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen)
/* Extract the data for the public key algorithm  */
int x509_extract_key_data(void *context, size_t hdrlen, unsigned char tag, const void *value, size_t vlen)
{
	struct x509_parse_context *ctx = context;
	ctx->key_algo = ctx->last_oid;
	if (ctx->last_oid == OID_rsaEncryption)
		ctx->cert->pub->pkey_algo = "rsa";
	else if (ctx->last_oid == OID_gost2012PKey256 ||
		 ctx->last_oid == OID_gost2012PKey512)
		ctx->cert->pub->pkey_algo = "ecrdsa";
	else
		return -ENOPKG;
	if (vlen < 1 || *(const u8 *)value != 0)
		return -EBADMSG;
	ctx->key = value + 1;
	ctx->key_size = vlen - 1;
	return 0;
}