pkix-signature-builtin.cpp revision 13493ab7596e827b8d0caab2c89e635dd65f78f9
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * IPRT - Crypto - Public Key Signature Schemas, Built-in providers.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Copyright (C) 2006-2014 Oracle Corporation
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * available from http://www.virtualbox.org. This file is free software;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * you can redistribute it and/or modify it under the terms of the GNU
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * General Public License (GPL) as published by the Free Software
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * The contents of this file may alternatively be used under the terms
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * of the Common Development and Distribution License Version 1.0
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * VirtualBox OSE distribution, in which case the provisions of the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * CDDL are applicable instead of those of the GPL.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * You may elect to license modified versions of this file under the
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * terms and conditions of either the GPL or the CDDL or both.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/*******************************************************************************
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync* Header Files *
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync*******************************************************************************/
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync/*******************************************************************************
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync* Global Variables *
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync*******************************************************************************/
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Array of built in message digest vtables.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncstatic PCRTCRPKIXSIGNATUREDESC const g_apPkixSignatureDescriptors[] =
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncPCRTCRPKIXSIGNATUREDESC RTCrPkixSignatureFindByObjIdString(const char *pszObjId, void **ppvOpaque)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Primary OIDs.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync uint32_t i = RT_ELEMENTS(g_apPkixSignatureDescriptors);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync while (i-- > 0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync if (strcmp(g_apPkixSignatureDescriptors[i]->pszObjId, pszObjId) == 0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Alias OIDs.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync while (i-- > 0)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync const char * const *ppszAliases = g_apPkixSignatureDescriptors[i]->papszObjIdAliases;
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync#if 0//def IPRT_WITH_OPENSSL
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Try EVP and see if it knows the algorithm.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync const EVP_MD *pEvpMdType = EVP_get_digestbyname(pszAlogSn);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync * Return the OpenSSL provider descriptor and the EVP_MD address.
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncPCRTCRPKIXSIGNATUREDESC RTCrPkixSignatureFindByObjId(PCRTASN1OBJID pObjId, void **ppvOpaque)
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return RTCrPkixSignatureFindByObjIdString(pObjId->szObjId, ppvOpaque);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTDECL(int) RTCrPkixSignatureCreateByObjIdString(PRTCRPKIXSIGNATURE phSignature, const char *pszObjId, bool fSigning,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync PCRTCRPKIXSIGNATUREDESC pDesc = RTCrPkixSignatureFindByObjIdString(pszObjId, &pvOpaque);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync return RTCrPkixSignatureCreate(phSignature, pDesc, pvOpaque, fSigning, pKey, pParams);
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsyncRTDECL(int) RTCrPkixSignatureCreateByObjId(PRTCRPKIXSIGNATURE phSignature, PCRTASN1OBJID pObjId, bool fSigning,
13493ab7596e827b8d0caab2c89e635dd65f78f9vboxsync PCRTCRPKIXSIGNATUREDESC pDesc = RTCrPkixSignatureFindByObjId(pObjId, &pvOpaque);