CT_Structure_To_Armor

Armoring is the term used in PGP and MIME to describe the formatting of binary data such that it can be unambiguously embedded in a printable document such as an email.

The Base 64 encoding method is used to make binary data printable and the encoding is clearly marked with BEGIN and END statements.

The function formats an arbitary structure – such as a ticket - into an Armored (printable format).

The result is returned as a buffer that the caller must free after use.

Synopsis

CK_RV CT_Structure_To_Armor( 
    
    char *  pLabel,/* IN Armor label (string) */
    char * pComment,/* optional comment string */
    CK_VOID_PTR pData, /* IN data to armor */
    CK_ULONG ulDataLen /* IN length of data */
 
    CK_BYTE_PTR *pArmor, /* OUT Armored structure created 
(free after use) */
    CK_ULONG_PTR pulArmorLen /* IN/OUT pArmor buffer length */
);

Example

If Armoring the binary data 01h 23h 45h 67h 89h abh cdh efh with the label “SETATTRIBUTE TICKET” and the comment “This is a trial certificate\n”.

You get:

This is a trial certificate
-----BEGIN SETATTRIBUTE TICKET-----
ASNFZ4mrze8=
-----END SETATTRIBUTE TICKET-----