VirtualBox

Changeset 52537 in vbox for trunk/include/iprt/crypto


Ignore:
Timestamp:
Aug 31, 2014 7:28:17 PM (10 years ago)
Author:
vboxsync
Message:

IPRT,SUP: First part of timestamp counter signatures support.

Location:
trunk/include/iprt/crypto
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/crypto/pkcs7.h

    r52503 r52537  
    174174#define RTCR_PKCS9_ID_COUNTER_SIGNATURE_OID "1.2.840.113549.1.9.6"
    175175/** @} */
     176
     177/**
     178 * Get the (next) signing time attribute from the specfied SignerInfo or one of
     179 * the immediate counter signatures.
     180 *
     181 * @returns Pointer to the signing time if found, NULL if not.
     182 * @param   pThis               The SignerInfo to search.
     183 * @param   ppSignerInfo        Pointer to variable keeping track of the
     184 *                              enumeration, optional.
     185 *
     186 *                              If specified the input value is taken to the be
     187 *                              SignerInfo of the previously returned signing
     188 *                              time.  The value pointed to is NULL, the
     189 *                              search/enum restarts.
     190 *
     191 *                              On successful return this is set to the
     192 *                              SignerInfo which we found the signing time in.
     193 */
     194RTDECL(PCRTASN1TIME) RTCrPkcs7SignerInfo_GetSigningTime(PCRTCRPKCS7SIGNERINFO pThis, PCRTCRPKCS7SIGNERINFO *ppSignerInfo);
     195
    176196
    177197
     
    302322 *                              This is NIL_RTCRX509CERTPATHS if the certificate
    303323 *                              is directly trusted.
     324 * @param   fFlags              Mix of the RTCRPKCS7VCC_F_XXX flags.
    304325 * @param   pvUser              The user argument.
    305326 * @param   pErrInfo            Optional error info buffer.
    306327 */
    307 typedef DECLCALLBACK(int) RTCRPKCS7VERIFYCERTCALLBACK(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
    308                                                       void *pvUser, PRTERRINFO pErrInfo);
    309 /** Pointer to a RTCRPKCS7VERIFYCERTCALLBACK callback. */
    310 typedef RTCRPKCS7VERIFYCERTCALLBACK *PRTCRPKCS7VERIFYCERTCALLBACK;
     328typedef DECLCALLBACK(int) FNRTCRPKCS7VERIFYCERTCALLBACK(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
     329                                                        uint32_t fFlags, void *pvUser, PRTERRINFO pErrInfo);
     330/** Pointer to a FNRTCRPKCS7VERIFYCERTCALLBACK callback. */
     331typedef FNRTCRPKCS7VERIFYCERTCALLBACK *PFNRTCRPKCS7VERIFYCERTCALLBACK;
     332
     333/** @name RTCRPKCS7VCC_F_XXX - Flags for FNRTCRPKCS7VERIFYCERTCALLBACK.
     334 * @{ */
     335/** Normal callback for a direct signatory of the signed data. */
     336#define RTCRPKCS7VCC_F_SIGNED_DATA                      RT_BIT_32(0)
     337/** Check that the signatory can be trusted for timestamps. */
     338#define RTCRPKCS7VCC_F_TIMESTAMP                        RT_BIT_32(1)
     339/** @} */
    311340
    312341/**
     
    314343 *  Default implementation that checks for the DigitalSignature KeyUsage bit.}
    315344 */
    316 RTDECL(int) RTCrPkcs7VerifyCertCallbackDefault(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
     345RTDECL(int) RTCrPkcs7VerifyCertCallbackDefault(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths, uint32_t fFlags,
    317346                                               void *pvUser, PRTERRINFO pErrInfo);
    318347
     
    321350 * Standard code signing.  Use this for Microsoft SPC.}
    322351 */
    323 RTDECL(int) RTCrPkcs7VerifyCertCallbackCodeSigning(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths,
     352RTDECL(int) RTCrPkcs7VerifyCertCallbackCodeSigning(PCRTCRX509CERTIFICATE pCert, RTCRX509CERTPATHS hCertPaths, uint32_t fFlags,
    324353                                                   void *pvUser, PRTERRINFO pErrInfo);
    325354
     
    337366 * @param   hTrustedCerts       Store containing trusted certificates.
    338367 * @param   pValidationTime     The time we're supposed to validate the
    339  *                              certificates chains at.
     368 *                              certificates chains at.  Ignored for signatures
     369 *                              with valid signing time attributes.
    340370 * @param   pfnVerifyCert       Callback for checking that a certificate used
    341371 *                              for signing the data is suitable.
     
    345375RTDECL(int) RTCrPkcs7VerifySignedData(PCRTCRPKCS7CONTENTINFO pContentInfo, uint32_t fFlags,
    346376                                      RTCRSTORE hAdditionalCerts, RTCRSTORE hTrustedCerts,
    347                                       PCRTTIMESPEC pValidationTime, PRTCRPKCS7VERIFYCERTCALLBACK pfnVerifyCert, void *pvUser,
     377                                      PCRTTIMESPEC pValidationTime, PFNRTCRPKCS7VERIFYCERTCALLBACK pfnVerifyCert, void *pvUser,
    348378                                      PRTERRINFO pErrInfo);
    349379
    350380/** @name RTCRPKCS7VERIFY_SD_F_XXX - Flags for RTCrPkcs7VerifySignedData
    351381 * @{ */
     382/** Always use the signing time attribute if present, requiring it to be
     383 * verified as valid.  The default behavior is to ignore unverifiable
     384 * signing time attributes and use the @a pValidationTime instead. */
     385#define RTCRPKCS7VERIFY_SD_F_ALWAYS_USE_SIGNING_TIME_IF_PRESENT     RT_BIT_32(0)
     386/** Only use signging time attributes from counter signatures. */
     387#define RTCRPKCS7VERIFY_SD_F_COUNTER_SIGNATURE_SIGNING_TIME_ONLY    RT_BIT_32(1)
     388/** Don't validate the counter signature containing the signing time, just use
     389 * it unverified.  This is useful if we don't necessarily have the root
     390 * certificates for the timestamp server handy, but use with great care. */
     391#define RTCRPKCS7VERIFY_SD_F_USE_SIGNING_TIME_UNVERIFIED            RT_BIT_32(2)
     392/** Indicates internally that we're validating a counter signature and should
     393 * use different rules when checking out the authenticated attributes.
     394 * @internal  */
     395#define RTCRPKCS7VERIFY_SD_F_COUNTER_SIGNATURE                      RT_BIT_32(31)
    352396/** @} */
    353397
  • trunk/include/iprt/crypto/x509.h

    r51856 r52537  
    801801#define RTCRX509CERT_EKU_F_IPSEC_TUNNEL                     RT_BIT_64(6)
    802802#define RTCRX509CERT_EKU_F_IPSEC_USER                       RT_BIT_64(7)
    803 #define RTCRX509CERT_EKU_F_TIME_STAMPING                    RT_BIT_64(8)
     803#define RTCRX509CERT_EKU_F_TIMESTAMPING                     RT_BIT_64(8)
    804804#define RTCRX509CERT_EKU_F_OCSP_SIGNING                     RT_BIT_64(9)
    805805#define RTCRX509CERT_EKU_F_DVCS                             RT_BIT_64(10)
     
    835835#define RTCRX509_ID_KP_IPSEC_TUNNEL_OID                     "1.3.6.1.5.5.7.3.6"
    836836#define RTCRX509_ID_KP_IPSEC_USER_OID                       "1.3.6.1.5.5.7.3.7"
    837 #define RTCRX509_ID_KP_TIME_STAMPING_OID                    "1.3.6.1.5.5.7.3.8"
     837#define RTCRX509_ID_KP_TIMESTAMPING_OID                     "1.3.6.1.5.5.7.3.8"
    838838#define RTCRX509_ID_KP_OCSP_SIGNING_OID                     "1.3.6.1.5.5.7.3.9"
    839839#define RTCRX509_ID_KP_DVCS_OID                             "1.3.6.1.5.5.7.3.10"
     
    876876/** @} */
    877877
    878 /** @name Microsoft extended key usage OIDs
     878/** @name Apple extended key usage OIDs
    879879 * @{ */
    880880#define RTCRX509_APPLE_EKU_APPLE_EXTENDED_KEY_USAGE_OID     "1.2.840.113635.100.4"
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette