Community articleCertificate_GetBlob function
Added by IBM contributorIBM on May 2, 2012
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.



Description

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

Function

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


Parameters

Table 1. Function parameters
ExpressionTypeDescription
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.


Returns

OK on success or an error code on failure.

Example

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 
*blobSizePtr)
   {
   SecurityUserStatusType theStatus;
 
      /* Get the Blob from the certificate. */
 
      if ((Certificate_GetBlob(theCert, &theStatus, theBlobPtr, blobSizePtr) 
         != OK)
      {
         fprintf(stderr, "Certificate_GetBlob call failed.\n");
         return(NOTOK);
      }
 
      /* Check the status to ensure the function worked correctly. */
 
      if (theStatus != SUSTATUS_OK)
      {
         fprintf(stderr, "GetBlob exited with wrong status.\n");
         return(NOTOK);
      }
      return(OK);
   }


Parent topic:
Certificate functions