pkcs7-core.cpp revision 4ee2f4fc8e99dc69ba5d63fd7dd3f52a38d0501e
/* $Id$ */
/** @file
* IPRT - Crypto - PKCS \#7, Core APIs.
*/
/*
* Copyright (C) 2006-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#include "pkcs7-internal.h"
/*
* PCKS #7 SignerInfo
*/
RTDECL(PCRTASN1TIME) RTCrPkcs7SignerInfo_GetSigningTime(PCRTCRPKCS7SIGNERINFO pThis, PCRTCRPKCS7SIGNERINFO *ppSignerInfo)
{
/*
* Check the immediate level, unless we're continuing a previous search.
* Note! We ASSUME a single signing time attribute, which simplifies the interface.
*/
{
while (cAttrsLeft-- > 0)
{
{
if (ppSignerInfo)
*ppSignerInfo = pThis;
}
pAttr++;
}
}
else if (*ppSignerInfo == pThis)
*ppSignerInfo = NULL;
/*
* Check counter signatures.
*/
while (cAttrsLeft-- > 0)
{
{
/* Skip past the previous counter signature. */
while (cSignatures > 0)
{
cSignatures--;
if (pSignature == *ppSignerInfo)
{
*ppSignerInfo = NULL;
pSignature++;
break;
}
pSignature++;
}
/* Search the counter signatures (if any remaining). */
while (cSignatures-- > 0)
{
while (cCounterAttrsLeft-- > 0)
{
{
if (ppSignerInfo)
}
pCounterAttr++;
}
pSignature++;
}
}
pAttr++;
}
/*
* No signing timestamp found.
*/
if (ppSignerInfo)
*ppSignerInfo = NULL;
return NULL;
}
RTDECL(PCRTASN1TIME) RTCrPkcs7SignerInfo_GetMsTimestamp(PCRTCRPKCS7SIGNERINFO pThis, PCRTCRPKCS7CONTENTINFO *ppContentInfo)
{
/*
* Assume there is only one, so no need to enumerate anything here.
*/
while (cAttrsLeft-- > 0)
{
{
while (cLeft-- > 0)
{
{
RTCRTSPTSTINFO_OID) == 0)
{
if (ppContentInfo)
}
}
pContentInfo++;
}
}
pAttr++;
}
/*
* No signature was found.
*/
if (ppContentInfo)
*ppContentInfo = NULL;
return NULL;
}
/*
* PCKS #7 ContentInfo.
*/
{
}
/*
* Set of some kind of certificate supported by PKCS #7 or CMS.
*/
{
&& RTCrX509Certificate_MatchIssuerAndSerialNumber(pCertificates->paItems[i].u.pX509Cert, pIssuer, pSerialNumber))
return NULL;
}
/*
* Generate the standard core code.
*/
#include <iprt/asn1-generator-core.h>