Example #1
0
TCertStatus PkiUtil::CheckUserCertValidityL(RPKIServiceAPI& aPkiService,
        CDesC8ArrayFlat& aValidCaCertNameList,
        TOwnCertInfo& aOwnCert)
{

    static const TInt KUndefinedKeySize = 0;

    TCertStatus status = ECertValid;

    HBufC8* subjectName = NULL;
    HBufC8* rfc822Name = NULL;

    if (aOwnCert.iOwnCertExists)
    {
        // Reserve enough space for UTF-8
        TInt len = 3*( aOwnCert.iSubjectDnSuffix.Length() );
        subjectName = HBufC8::NewLC(len);
        TPtr8 subjectNamePtr = subjectName->Des();
        if (CnvUtfConverter::ConvertFromUnicodeToUtf8(subjectNamePtr, aOwnCert.iSubjectDnSuffix) != 0)
        {
            User::Leave(KErrCorrupt);
        }

        if ( aOwnCert.iIdentityAsRfc822Name == EIdentityAsRfc822NameYes)
        {
            rfc822Name = HBufC8::NewLC(aOwnCert.iRfc822NameFqdn.Length());
            TPtr8 rfc822NamePtr = rfc822Name->Des();
            if (CnvUtfConverter::ConvertFromUnicodeToUtf8(rfc822NamePtr, aOwnCert.iRfc822NameFqdn) != 0)
            {
                User::Leave(KErrCorrupt);
            }

        }
        else
        {
            rfc822Name = HBufC8::NewLC(1); //empty string
        }

        status = ECertNotFound;
        for (TInt i = 0; i < aValidCaCertNameList.Count(); ++i)
        {

            status = CertStatusL(aPkiService, aValidCaCertNameList[i],
                                 *subjectName, *rfc822Name,
                                 KUndefinedKeySize);
            if (status != ECertNotFound)
            {
                break;
            }
        }

        CleanupStack::PopAndDestroy(rfc822Name);
        CleanupStack::PopAndDestroy(subjectName);
    }

    return status;
}
QStringList S60FormatSupported::supportedPlayMimeTypesL()
{
    RArray<TUid> mediaIds; //search for both audio and video
    RMMFControllerImplInfoArray iControllers;
    m_controllerparam = CMMFControllerPluginSelectionParameters::NewL();
    m_playformatparam = CMMFFormatSelectionParameters::NewL();
    mediaIds.Append(KUidMediaTypeAudio);
    mediaIds.Append(KUidMediaTypeVideo);
    m_controllerparam->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
    m_controllerparam->SetRequiredPlayFormatSupportL(*m_playformatparam);
    m_controllerparam->ListImplementationsL(iControllers);
    CDesC8ArrayFlat* controllerArray = new (ELeave) CDesC8ArrayFlat(1);
    for (TInt i = 0; i < iControllers.Count(); i++) {
        for (TInt j = 0; j < (iControllers[i]->PlayFormats()).Count(); j++) {
            const CDesC8Array& iarr = (iControllers[i]->PlayFormats()[j]->SupportedMimeTypes());
            TInt count = iarr.Count();
            for (TInt k = 0; k < count; k++) {
                TPtrC8 ptr = iarr.MdcaPoint(k);
                HBufC8* n = HBufC8::NewL(ptr.Length());
                TPtr8 ptr1 = n->Des();
                ptr1.Copy((TUint8*) ptr.Ptr(), ptr.Length());
                controllerArray->AppendL(ptr1);
            }
        }
    }

    // converting CDesC8Array to QStringList
    for (TInt x = 0; x < controllerArray->Count(); x++) {
        m_supportedplaymime.append(QString::fromUtf8(
                (const char*) (controllerArray->MdcaPoint(x).Ptr()),
                controllerArray->MdcaPoint(x).Length()));
    }

    // populating the list with only audio and controller mime types
    QStringList tempaudio = m_supportedplaymime.filter(QString("audio"));
    QStringList tempvideo = m_supportedplaymime.filter(QString("video"));

    m_supportedplaymime.clear();
    m_supportedplaymime = tempaudio + tempvideo;
    mediaIds.Close();
    delete controllerArray;
    iControllers.ResetAndDestroy();
    return m_supportedplaymime;
}