Community articleCertificate_GetBlob function
Added by IBM contributorIBM on August 16, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function extracts a binary long object (Blob). This Blob is a DER-encoded certificate.


   r_error Certificate_GetBlob(
      Certificate *theCertificate, 
      SecurityUserStatusType *theStatus, 
      r_byte **theBlob, 
      r_long *blobSize);


Table 1. Function parameters
theCertificate Certificate*A pointer to the certificate object.
theStatusSecurityUserStatusType*A pointer that is set with the status of the operation. This will be one of the following:
SUSTATUS_OK — The operation was successful.
SUSTATUS_CANCELLED — the operation was cancelled by the user.
SUSTATUS_INPUT_REQUIRED — the operation required user input, but could not receive it (for example, it was run on a server with no user).
theBlob r_byte**A pointer that is set with the Blob.
blobSize r_long*A pointer that is set with the length of the Blob.


OK on success or an error code on failure.


The following function extracts the Blob from a certificate, checks the status to make sure the operation was successful, then returns the Blob and size as parameters.
   r_error extractBlob(Certificate *theCert, r_byte **theBlobPtr, r_long 
   SecurityUserStatusType theStatus;
      /* Get the Blob from the certificate. */
      if ((Certificate_GetBlob(theCert, &theStatus, theBlobPtr, blobSizePtr) 
         != OK)
         fprintf(stderr, "Certificate_GetBlob call failed.\n");
      /* Check the status to ensure the function worked correctly. */
      if (theStatus != SUSTATUS_OK)
         fprintf(stderr, "GetBlob exited with wrong status.\n");

Parent topic:
Certificate functions