TSPI_CONTEXT_GETKEYBYPUBLICINFO(3)

πŸ’– Tspi_Context_GetKeyByPublicInfo(3) πŸ’–

okay bestie, gather round, because this one is a TCG Software Stack Developer's Reference page and it's genuinely kind of iconic. it's from the TSS crew, manual name Tspi_C...licInfo(3) (yes the title gets truncated like that, it's giving "my name is too long for the header", we love her anyway) πŸŽ€


✨ NAME ✨

Tspi_Context_GetKeyByPublicInfo β€” search the persistent storage for a registered key using the provided public key information


🌸 SYNOPSIS 🌸

#include <tss/platform.h>
#include <tss/tcpa_defines.h>
#include <tss/tcpa_typedef.h>
#include <tss/tcpa_struct.h>
#include <tss/tss_typedef.h>
#include <tss/tss_structs.h>
#include <tss/tspi.h>

TSS_RESULT Tspi_Context_GetKeyByPublicInfo(TSS_HCONTEXT     hContext,      TSS_FLAG  persistentStorageType,
                                           TSS_ALGORITHM_ID algID,         UINT32    ulPublicInfoLength,
                                           BYTE*            rgbPublicInfo, TSS_HKEY* phKey);

like, look at that signature. seven includes just to say hi. she's high maintenance and she's worth it πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so TSS_Context_GetKeyByPublicInfo goes and searches the persistent storage for a registered key, using the public key info you hand it, and then it creates a key object initialized according to the data it found. no cap, that's the whole vibe.

and when the method completes successfully? you get back a handle to that brand-new key object it just made. a little gift. a little treat. 🫢


πŸ‘‘ PARAMETERS πŸ‘‘

hContext

the handle of the context object. your entry ticket, your little backstage pass. ✨

persistentStorageType

a flag indicating which persistent storage the key is registered in. i.e. where in the storage world we're looking. πŸ—ΊοΈ

algId

this parameter indicates the algorithm of the requested key. what kind of key are we even asking for, bestie. πŸ€”

ulPublicInfoLength

the length of the public key info provided at the parameter rgbPublicInfo. just the size. the measurements. πŸ“

rgbPublicInfo

the public key info is provided to identify the key to look for in the persistent storage. important detail: in case algID equals TSS_ALG_RSA, this parameter contains the modulus of the public RSA key. so if you're doing RSA, that's the thing that goes here, not something else. noted. πŸ“

hKey

receives the handle of the key object representing the key. and β€” big mood β€” in case the key hasn't been found, this value will be NULL. so check it, fr fr. 😭


πŸ”₯ RETURN CODES πŸ”₯

Tspi_Context_GetKeyByPublicInfo returns TSS_SUCCESS on success. otherwise one of these little guys comes back at you:

  • TSS_E_INVALID_HANDLE β€” hContext is an invalid handle. πŸ’€
  • TSS_E_INTERNAL_ERROR β€” an error occurred internal to the TSS. not our fault, not your fault, the TSS is just going through something.

🌈 CONFORMING TO 🌈

Tspi_Context_GetKeyByPublicInfo conforms to the Trusted Computing Group Software Specification version 1.1 Golden. certified, spec-compliant, main character energy. ⭐


πŸŽ€ SEE ALSO πŸŽ€

like if you liked this one, you'll love that one. iykyk. πŸ’œ


ok and one last thing: algID vs algId β€” the docs spell it both ways in the description and the parameter name. i am simply reporting the lore, not fixing it. πŸ™ˆ

that's the whole page, bestie! this one came to you from the TSS 1.1 era, dated 2004-05-26, out of the TCG Software Stack Developer's Reference set β€” so yeah, vintage, but she still ate. go forth and get those keys. πŸ§šβ€β™€οΈβœ¨πŸ“