created why2_chat_ecc_deserialize_public_key fn
This commit is contained in:
parent
313c2930e9
commit
bf354372ff
@ -44,6 +44,7 @@ char *why2_chat_ecc_sign(char *message); //SIGN message WITH ECC KEY
|
|||||||
why2_bool why2_chat_ecc_verify_signature(char *message, char *signature, EVP_PKEY *key);
|
why2_bool why2_chat_ecc_verify_signature(char *message, char *signature, EVP_PKEY *key);
|
||||||
|
|
||||||
char *why2_chat_ecc_serialize_public_key(); //GET PUBLIC ECC KEY IN BASE64
|
char *why2_chat_ecc_serialize_public_key(); //GET PUBLIC ECC KEY IN BASE64
|
||||||
|
EVP_PKEY* why2_chat_ecc_deserialize_public_key(char *pubkey); //GET EVP_PKEY FROM BASE64 PUBLIC ECC KEY
|
||||||
|
|
||||||
char *why2_sha256(char *input); //HASH input USING SHA256 AND RETURN IN STRING
|
char *why2_sha256(char *input); //HASH input USING SHA256 AND RETURN IN STRING
|
||||||
|
|
||||||
|
@ -223,6 +223,24 @@ char *why2_chat_ecc_serialize_public_key()
|
|||||||
return base64_encoded;
|
return base64_encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: Remove PEM
|
||||||
|
EVP_PKEY* why2_chat_ecc_deserialize_public_key(char *pubkey)
|
||||||
|
{
|
||||||
|
//VARIABLES
|
||||||
|
BIO *bio;
|
||||||
|
EVP_PKEY *key;
|
||||||
|
char *base64_decoded = base64_decode(pubkey, NULL);
|
||||||
|
|
||||||
|
//EXTRACT KEY
|
||||||
|
bio = BIO_new_mem_buf(base64_decoded, -1);
|
||||||
|
key = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
//DEALLOCATION
|
||||||
|
BIO_free(bio);
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
void why2_chat_deallocate_keys(void)
|
void why2_chat_deallocate_keys(void)
|
||||||
{
|
{
|
||||||
//DEALLOCATE THE pkey
|
//DEALLOCATE THE pkey
|
||||||
|
Loading…
x
Reference in New Issue
Block a user