コード例 #1
0
ANSC_HANDLE
AnscAsn1CertificateRequestCreateChildObject
    (
        ANSC_HANDLE                 hThisObject,
        ULONG                       index
    )
{
    PANSC_ASN1_OBJECT               pThisObject      = NULL;
    PANSC_ASN1_SEQUENCE             pParent          = (PANSC_ASN1_SEQUENCE)hThisObject;

    switch( index )
    {

        case 0:

            pThisObject = AnscAsn1CreateCertificationRequestInfo(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
            }

            break;

        case 1:

            pThisObject = AnscAsn1CreateSignatureAlgorithmIdentifier(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
            }

            break;

        case 2:

            pThisObject = AnscAsn1CreateBitString(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
            }

            break;

    }

    return pThisObject;

}
コード例 #2
0
ANSC_HANDLE
AnscAsn1CertificationRequestInfoCreateChildObject
    (
        ANSC_HANDLE                 hThisObject,
        ULONG                       index
    )
{
    PANSC_ASN1_OBJECT               pThisObject      = NULL;
    PANSC_ASN1_SEQUENCE             pParent          = (PANSC_ASN1_SEQUENCE)hThisObject;

    switch( index )
    {

        case 0:

            pThisObject = AnscAsn1CreateInteger(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
                pThisObject->bCanBeOptional = TRUE;
                pThisObject->bOptional = TRUE;
            }

            break;

        case 1:

            pThisObject = AnscAsn1CreateName(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
            }

            break;

        case 2:

            pThisObject = AnscAsn1CreateSubjectPublicKeyInfo(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
            }

            break;

        case 3:

            pThisObject = AnscAsn1CreateAttributes(NULL);

            if( pThisObject != NULL)
            {
                pThisObject->AddAttribute(pThisObject, pParent->CreateChildAttr(pParent,index), FALSE);
                pThisObject->SetName(pThisObject, pParent->GetChildName(pParent,index));
                pThisObject->bCanBeOptional = TRUE;
                pThisObject->bOptional = TRUE;
            }

            break;

    }

    return pThisObject;

}