コード例 #1
0
PUCHAR
AdvPKIEntityCreateSelfSignedCertEncoding
    (
        ANSC_HANDLE                 hThisObject,
        BOOLEAN                     bHasKeyIdentifier,
        PULONG                      pLength
    )
{
    PPKI_CLIENT_ENTITY              pThisObject  = (PPKI_CLIENT_ENTITY)hThisObject;
    PANSC_ASN1_OBJECT               pCert;
    PUCHAR                          pEncoding;

    if( hThisObject == NULL || pLength == NULL)
    {
        return NULL;
    }

    pCert = (PANSC_ASN1_OBJECT)pThisObject->CreateSelfSignedCert(pThisObject,bHasKeyIdentifier);

    if( pCert == NULL)
    {
        return NULL;
    }

    pEncoding =  pCert->GetEncodedData(pCert, pLength);

    pCert->AsnFree(pCert);

    return pEncoding;

}
コード例 #2
0
ANSC_STATUS
AnscAsn1CertificateRequestFree
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PANSC_ASN1_CERTIFICATEREQUEST   pBaseObject  = (PANSC_ASN1_CERTIFICATEREQUEST)hThisObject;
    PANSC_ASN1_OBJECT               pChild       = NULL;

    if( pBaseObject != NULL)
    {
        /* free the signed data part */
        if( pBaseObject->pSignedData != NULL && pBaseObject->uSignedLength > 0)
        {
            AnscFreeMemory(pBaseObject->pSignedData);
        }

        /*
         *  Remove the children here, from the end;
         */
        pBaseObject->RemoveAllChildren(pBaseObject,TRUE);

        /*
         *  Remove the extra child;
         */
        pChild = pBaseObject->pExtraChild;

        if( pChild != NULL)
        {
            pChild->AsnFree(pChild);
        }

        if( pBaseObject->Name != NULL)
        {
            AnscFreeMemory(pBaseObject->Name);
        }

        if( pBaseObject->ClassName != NULL)
        {
            AnscFreeMemory(pBaseObject->ClassName);
        }

        AttrListRemoveAllAttributes(&pBaseObject->sAttrList);

        AnscFreeMemory(pBaseObject);
    }

    return  ANSC_STATUS_SUCCESS;
}
コード例 #3
0
/**********************************************************************

    caller:     owner of the object

    prototype:

        ANSC_HANDLE
        AnscAsn1Clone
            (
                ANSC_HANDLE                 hThisObject
            );

    description:

        This function clones a same ASN.1 object.

    argument:   ANSC_HANDLE                 hContainerContext
                This handle is actually the pointer of this object
                itself.

    return:     The cloned container object.

**********************************************************************/
ANSC_HANDLE
AnscAsn1Clone
    (
        ANSC_HANDLE                 hThisObject
    )
{
    PANSC_ASN1_OBJECT               pMyObject    = (PANSC_ASN1_OBJECT)hThisObject;
    PANSC_ASN1_OBJECT               pNewObject   = NULL;

    pNewObject = 
        pMyObject->Create
            (
                pMyObject->hContainerContext
            );

    if( pNewObject == NULL)
    {
        AnscTrace("Failed to clone at AnscAsn1SetOfClone()\n");

        return NULL;
    }

    /*
     *  Copy all the attributes;
     */
    /* AttrListCopyAllAttributes( &pNewObject->sAttrList, &pMyObject->sAttrList);*/
    pNewObject->SetName(pNewObject, pMyObject->Name);

    if( !pMyObject->CopyTo(pMyObject, pNewObject))
    {
        pNewObject->AsnFree(pNewObject);

        return NULL;
    }

    return pNewObject;
}