EVP_PKEY_GET_GROUP_NAME(3ossl)

πŸ’– EVP_PKEY_GET_GROUP_NAME πŸ’–

okay bestie, gather round, because today we're learning about EVP_PKEY_get_group_name from the 3ossl manual β€” yes that's the OpenSSL manual, section 3, and it's literally the cutest lil function for pulling the group name out of a key. πŸŽ€


✨ NAME ✨

EVP_PKEY_get_group_name β€” get the group name of a key. that's it, that's the whole job, she's a specialist πŸ’…


🌸 SYNOPSIS 🌸

#include <openssl/evp.h>

int EVP_PKEY_get_group_name(EVP_PKEY *pkey, char *gname, size_t gname_sz,
                            size_t *gname_len);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea. EVP_PKEY_get_group_name() fills in the group name of the pkey into gname, and it writes up to at most gname_sz bytes β€” and yes, that count includes the ending NUL byte, so budget for the terminator, she's not free 🫢

then it assigns *gname_len the actual length of the name, not including the NUL byte. the actual length, bestie. the real one. no cap.

and here's the flexible part: gname as well as gname_len may individually be NULL β€” either one, independently β€” and in that case that thing just won't be filled in or assigned. so if you pass NULL for gname, nothing gets written there; if you pass NULL for gname_len, nothing gets assigned there. they're not a package deal πŸ™ˆ

little note on the vibe: this all hinges on whether pkey's key type supports it in the first place. more on that below πŸ‘‡

πŸ‘‘ NOTES πŸ‘‘

among the standard OpenSSL key types, this is only supported for DH, EC and SM2 keys. periodt.

other providers may support this for additional key types though β€” so like, don't assume it's just those three forever, but if you're on stock OpenSSL key types, it's DH, EC, and SM2. that's the list, bestie 🌈


⭐ RETURN VALUES ⭐

EVP_PKEY_get_group_name() returns 1 if the group name could be filled in, otherwise 0.

that's the whole vibe check: 1 = slay, we got the name. 0 = nope, didn't happen. πŸ”₯


πŸ•°οΈ HISTORY πŸ•°οΈ

this function was added in OpenSSL 3.0. so if you're on something older, she does not exist, sorry babe 😭


Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.

fr fr read the license before you do anything, it's giving legally binding πŸ’€

and that's the whole page, bestie 🧚✨ this was 3ossl from OpenSSL 3.5.9, dated 2026-09-29 β€” mwah, go get that group name, you main character πŸ’–πŸ’…πŸ¦‹

πŸ“¦ where this page comes from