]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Include/Library/BaseCryptLib.h
CryptoPkg/BaseCryptLib.h: Add new API to get organization name
[mirror_edk2.git] / CryptoPkg / Include / Library / BaseCryptLib.h
index 1350000b79786a14c864c346371df4b6423cb236..6183bb0df4455180407a58968df63dde08953405 100644 (file)
@@ -2200,6 +2200,41 @@ X509GetCommonName (
   IN OUT  UINTN        *CommonNameSize\r
   );\r
 \r
+/**\r
+  Retrieve the organization name (O) string from one X.509 certificate.\r
+\r
+  @param[in]      Cert             Pointer to the DER-encoded X509 certificate.\r
+  @param[in]      CertSize         Size of the X509 certificate in bytes.\r
+  @param[out]     NameBuffer       Buffer to contain the retrieved certificate organization\r
+                                   name string. At most NameBufferSize bytes will be\r
+                                   written and the string will be null terminated. May be\r
+                                   NULL in order to determine the size buffer needed.\r
+  @param[in,out]  NameBufferSize   The size in bytes of the Name buffer on input,\r
+                                   and the size of buffer returned Name on output.\r
+                                   If NameBuffer is NULL then the amount of space needed\r
+                                   in buffer (including the final null) is returned.\r
+\r
+  @retval RETURN_SUCCESS           The certificate Organization Name retrieved successfully.\r
+  @retval RETURN_INVALID_PARAMETER If Cert is NULL.\r
+                                   If NameBufferSize is NULL.\r
+                                   If NameBuffer is not NULL and *CommonNameSize is 0.\r
+                                   If Certificate is invalid.\r
+  @retval RETURN_NOT_FOUND         If no Organization Name entry exists.\r
+  @retval RETURN_BUFFER_TOO_SMALL  If the NameBuffer is NULL. The required buffer size\r
+                                   (including the final null) is returned in the\r
+                                   CommonNameSize parameter.\r
+  @retval RETURN_UNSUPPORTED       The operation is not supported.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+X509GetOrganizationName (\r
+  IN      CONST UINT8   *Cert,\r
+  IN      UINTN         CertSize,\r
+  OUT     CHAR8         *NameBuffer,  OPTIONAL\r
+  IN OUT  UINTN         *NameBufferSize\r
+  );\r
+\r
 /**\r
   Verify one X509 certificate was issued by the trusted CA.\r
 \r