libwinpr-crypto: started stubbing CryptoAPI
This commit is contained in:
parent
fd993a5997
commit
0e02134c40
31
winpr/include/winpr/crypto.h
Normal file
31
winpr/include/winpr/crypto.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/**
|
||||||
|
* WinPR: Windows Portable Runtime
|
||||||
|
* Cryptography API (CryptoAPI)
|
||||||
|
*
|
||||||
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WINPR_CRYPTO_H
|
||||||
|
#define WINPR_CRYPTO_H
|
||||||
|
|
||||||
|
#include <winpr/winpr.h>
|
||||||
|
#include <winpr/wtypes.h>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* WINPR_CRYPTO_H */
|
||||||
|
|
42
winpr/libwinpr/crypto/CMakeLists.txt
Normal file
42
winpr/libwinpr/crypto/CMakeLists.txt
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# WinPR: Windows Portable Runtime
|
||||||
|
# libwinpr-crypto cmake build script
|
||||||
|
#
|
||||||
|
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
set(MODULE_NAME "winpr-crypto")
|
||||||
|
set(MODULE_PREFIX "WINPR_CRYPTO")
|
||||||
|
|
||||||
|
set(${MODULE_PREFIX}_SRCS
|
||||||
|
crypto.c
|
||||||
|
cert.c)
|
||||||
|
|
||||||
|
if(MSVC AND (NOT MONOLITHIC_BUILD))
|
||||||
|
set(${MODULE_PREFIX}_SRCS ${${MODULE_PREFIX}_SRCS} module.def)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_complex_library(MODULE ${MODULE_NAME} TYPE "OBJECT"
|
||||||
|
MONOLITHIC ${MONOLITHIC_BUILD}
|
||||||
|
SOURCES ${${MODULE_PREFIX}_SRCS})
|
||||||
|
|
||||||
|
set_target_properties(${MODULE_NAME} PROPERTIES VERSION ${WINPR_VERSION_FULL} SOVERSION ${WINPR_VERSION} PREFIX "lib")
|
||||||
|
|
||||||
|
if(MONOLITHIC_BUILD)
|
||||||
|
|
||||||
|
else()
|
||||||
|
install(TARGETS ${MODULE_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "WinPR")
|
||||||
|
|
9
winpr/libwinpr/crypto/ModuleOptions.cmake
Normal file
9
winpr/libwinpr/crypto/ModuleOptions.cmake
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
|
||||||
|
set(MINWIN_LAYER "1")
|
||||||
|
set(MINWIN_GROUP "core")
|
||||||
|
set(MINWIN_MAJOR_VERSION "1")
|
||||||
|
set(MINWIN_MINOR_VERSION "0")
|
||||||
|
set(MINWIN_SHORT_NAME "crypto")
|
||||||
|
set(MINWIN_LONG_NAME "Cryptography API (CryptoAPI)")
|
||||||
|
set(MODULE_LIBRARY_NAME "crypt32")
|
||||||
|
|
157
winpr/libwinpr/crypto/cert.c
Normal file
157
winpr/libwinpr/crypto/cert.c
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
/**
|
||||||
|
* WinPR: Windows Portable Runtime
|
||||||
|
* Cryptography API (CryptoAPI)
|
||||||
|
*
|
||||||
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crypto.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CertAddCertificateContextToStore
|
||||||
|
* CertAddCertificateLinkToStore
|
||||||
|
* CertAddCRLContextToStore
|
||||||
|
* CertAddCRLLinkToStore
|
||||||
|
* CertAddCTLContextToStore
|
||||||
|
* CertAddCTLLinkToStore
|
||||||
|
* CertAddEncodedCertificateToStore
|
||||||
|
* CertAddEncodedCertificateToSystemStoreA
|
||||||
|
* CertAddEncodedCertificateToSystemStoreW
|
||||||
|
* CertAddEncodedCRLToStore
|
||||||
|
* CertAddEncodedCTLToStore
|
||||||
|
* CertAddSerializedElementToStore
|
||||||
|
* CertAddStoreToCollection
|
||||||
|
* CertControlStore
|
||||||
|
* CertCloseStore
|
||||||
|
* CertDeleteCertificateFromStore
|
||||||
|
* CertDeleteCRLFromStore
|
||||||
|
* CertDeleteCTLFromStore
|
||||||
|
* CertDuplicateStore
|
||||||
|
* CertGetCRLFromStore
|
||||||
|
* CertEnumCertificatesInStore
|
||||||
|
* CertEnumCRLsInStore
|
||||||
|
* CertEnumCTLsInStore
|
||||||
|
* CertEnumPhysicalStore
|
||||||
|
* CertEnumSystemStore
|
||||||
|
* CertEnumSystemStoreLocation
|
||||||
|
* CertFindCertificateInStore
|
||||||
|
* CertFindChainInStore
|
||||||
|
* CertFindCRLInStore
|
||||||
|
* CertFindCTLInStore
|
||||||
|
* CertGetIssuerCertificateFromStore
|
||||||
|
* CertGetStoreProperty
|
||||||
|
* CertGetSubjectCertificateFromStore
|
||||||
|
* CertOpenStore
|
||||||
|
* CertOpenSystemStoreA
|
||||||
|
* CertOpenSystemStoreW
|
||||||
|
* CertRegisterPhysicalStore
|
||||||
|
* CertRegisterSystemStore
|
||||||
|
* CertRemoveStoreFromCollection
|
||||||
|
* CertSaveStore
|
||||||
|
* CertSerializeCertificateStoreElement
|
||||||
|
* CertSerializeCRLStoreElement
|
||||||
|
* CertSerializeCTLStoreElement
|
||||||
|
* CertSetStoreProperty
|
||||||
|
* CertUnregisterPhysicalStore
|
||||||
|
* CertUnregisterSystemStore
|
||||||
|
*
|
||||||
|
* CertAddEnhancedKeyUsageIdentifier
|
||||||
|
* CertAddRefServerOcspResponse
|
||||||
|
* CertAddRefServerOcspResponseContext
|
||||||
|
* CertAlgIdToOID
|
||||||
|
* CertCloseServerOcspResponse
|
||||||
|
* CertCompareCertificate
|
||||||
|
* CertCompareCertificateName
|
||||||
|
* CertCompareIntegerBlob
|
||||||
|
* CertComparePublicKeyInfo
|
||||||
|
* CertCreateCertificateChainEngine
|
||||||
|
* CertCreateCertificateContext
|
||||||
|
* CertCreateContext
|
||||||
|
* CertCreateCRLContext
|
||||||
|
* CertCreateCTLContext
|
||||||
|
* CertCreateCTLEntryFromCertificateContextProperties
|
||||||
|
* CertCreateSelfSignCertificate
|
||||||
|
* CertDuplicateCertificateChain
|
||||||
|
* CertDuplicateCertificateContext
|
||||||
|
* CertDuplicateCRLContext
|
||||||
|
* CertDuplicateCTLContext
|
||||||
|
* CertEnumCertificateContextProperties
|
||||||
|
* CertEnumCRLContextProperties
|
||||||
|
* CertEnumCTLContextProperties
|
||||||
|
* CertEnumSubjectInSortedCTL
|
||||||
|
* CertFindAttribute
|
||||||
|
* CertFindCertificateInCRL
|
||||||
|
* CertFindExtension
|
||||||
|
* CertFindRDNAttr
|
||||||
|
* CertFindSubjectInCTL
|
||||||
|
* CertFindSubjectInSortedCTL
|
||||||
|
* CertFreeCertificateChain
|
||||||
|
* CertFreeCertificateChainEngine
|
||||||
|
* CertFreeCertificateChainList
|
||||||
|
* CertFreeCertificateContext
|
||||||
|
* CertFreeCRLContext
|
||||||
|
* CertFreeCTLContext
|
||||||
|
* CertFreeServerOcspResponseContext
|
||||||
|
* CertGetCertificateChain
|
||||||
|
* CertGetCertificateContextProperty
|
||||||
|
* CertGetCRLContextProperty
|
||||||
|
* CertGetCTLContextProperty
|
||||||
|
* CertGetEnhancedKeyUsage
|
||||||
|
* CertGetIntendedKeyUsage
|
||||||
|
* CertGetNameStringA
|
||||||
|
* CertGetNameStringW
|
||||||
|
* CertGetPublicKeyLength
|
||||||
|
* CertGetServerOcspResponseContext
|
||||||
|
* CertGetValidUsages
|
||||||
|
* CertIsRDNAttrsInCertificateName
|
||||||
|
* CertIsStrongHashToSign
|
||||||
|
* CertIsValidCRLForCertificate
|
||||||
|
* CertNameToStrA
|
||||||
|
* CertNameToStrW
|
||||||
|
* CertOIDToAlgId
|
||||||
|
* CertOpenServerOcspResponse
|
||||||
|
* CertRDNValueToStrA
|
||||||
|
* CertRDNValueToStrW
|
||||||
|
* CertRemoveEnhancedKeyUsageIdentifier
|
||||||
|
* CertResyncCertificateChainEngine
|
||||||
|
* CertRetrieveLogoOrBiometricInfo
|
||||||
|
* CertSelectCertificateChains
|
||||||
|
* CertSetCertificateContextPropertiesFromCTLEntry
|
||||||
|
* CertSetCertificateContextProperty
|
||||||
|
* CertSetCRLContextProperty
|
||||||
|
* CertSetCTLContextProperty
|
||||||
|
* CertSetEnhancedKeyUsage
|
||||||
|
* CertStrToNameA
|
||||||
|
* CertStrToNameW
|
||||||
|
* CertVerifyCertificateChainPolicy
|
||||||
|
* CertVerifyCRLRevocation
|
||||||
|
* CertVerifyCRLTimeValidity
|
||||||
|
* CertVerifyCTLUsage
|
||||||
|
* CertVerifyRevocation
|
||||||
|
* CertVerifySubjectCertificateContext
|
||||||
|
* CertVerifyTimeValidity
|
||||||
|
* CertVerifyValidityNesting
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
149
winpr/libwinpr/crypto/crypto.c
Normal file
149
winpr/libwinpr/crypto/crypto.c
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* WinPR: Windows Portable Runtime
|
||||||
|
* Cryptography API (CryptoAPI)
|
||||||
|
*
|
||||||
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <winpr/crypto.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CryptAcquireCertificatePrivateKey
|
||||||
|
* CryptBinaryToStringA
|
||||||
|
* CryptBinaryToStringW
|
||||||
|
* CryptCloseAsyncHandle
|
||||||
|
* CryptCreateAsyncHandle
|
||||||
|
* CryptCreateKeyIdentifierFromCSP
|
||||||
|
* CryptDecodeMessage
|
||||||
|
* CryptDecodeObject
|
||||||
|
* CryptDecodeObjectEx
|
||||||
|
* CryptDecryptAndVerifyMessageSignature
|
||||||
|
* CryptDecryptMessage
|
||||||
|
* CryptEncodeObject
|
||||||
|
* CryptEncodeObjectEx
|
||||||
|
* CryptEncryptMessage
|
||||||
|
* CryptEnumKeyIdentifierProperties
|
||||||
|
* CryptEnumOIDFunction
|
||||||
|
* CryptEnumOIDInfo
|
||||||
|
* CryptExportPKCS8
|
||||||
|
* CryptExportPublicKeyInfo
|
||||||
|
* CryptExportPublicKeyInfoEx
|
||||||
|
* CryptExportPublicKeyInfoFromBCryptKeyHandle
|
||||||
|
* CryptFindCertificateKeyProvInfo
|
||||||
|
* CryptFindLocalizedName
|
||||||
|
* CryptFindOIDInfo
|
||||||
|
* CryptFormatObject
|
||||||
|
* CryptFreeOIDFunctionAddress
|
||||||
|
* CryptGetAsyncParam
|
||||||
|
* CryptGetDefaultOIDDllList
|
||||||
|
* CryptGetDefaultOIDFunctionAddress
|
||||||
|
* CryptGetKeyIdentifierProperty
|
||||||
|
* CryptGetMessageCertificates
|
||||||
|
* CryptGetMessageSignerCount
|
||||||
|
* CryptGetOIDFunctionAddress
|
||||||
|
* CryptGetOIDFunctionValue
|
||||||
|
* CryptHashCertificate
|
||||||
|
* CryptHashCertificate2
|
||||||
|
* CryptHashMessage
|
||||||
|
* CryptHashPublicKeyInfo
|
||||||
|
* CryptHashToBeSigned
|
||||||
|
* CryptImportPKCS8
|
||||||
|
* CryptImportPublicKeyInfo
|
||||||
|
* CryptImportPublicKeyInfoEx
|
||||||
|
* CryptImportPublicKeyInfoEx2
|
||||||
|
* CryptInitOIDFunctionSet
|
||||||
|
* CryptInstallDefaultContext
|
||||||
|
* CryptInstallOIDFunctionAddress
|
||||||
|
* CryptLoadSip
|
||||||
|
* CryptMemAlloc
|
||||||
|
* CryptMemFree
|
||||||
|
* CryptMemRealloc
|
||||||
|
* CryptMsgCalculateEncodedLength
|
||||||
|
* CryptMsgClose
|
||||||
|
* CryptMsgControl
|
||||||
|
* CryptMsgCountersign
|
||||||
|
* CryptMsgCountersignEncoded
|
||||||
|
* CryptMsgDuplicate
|
||||||
|
* CryptMsgEncodeAndSignCTL
|
||||||
|
* CryptMsgGetAndVerifySigner
|
||||||
|
* CryptMsgGetParam
|
||||||
|
* CryptMsgOpenToDecode
|
||||||
|
* CryptMsgOpenToEncode
|
||||||
|
* CryptMsgSignCTL
|
||||||
|
* CryptMsgUpdate
|
||||||
|
* CryptMsgVerifyCountersignatureEncoded
|
||||||
|
* CryptMsgVerifyCountersignatureEncodedEx
|
||||||
|
* CryptProtectData
|
||||||
|
* CryptProtectMemory
|
||||||
|
* CryptQueryObject
|
||||||
|
* CryptRegisterDefaultOIDFunction
|
||||||
|
* CryptRegisterOIDFunction
|
||||||
|
* CryptRegisterOIDInfo
|
||||||
|
* CryptRetrieveTimeStamp
|
||||||
|
* CryptSetAsyncParam
|
||||||
|
* CryptSetKeyIdentifierProperty
|
||||||
|
* CryptSetOIDFunctionValue
|
||||||
|
* CryptSignAndEncodeCertificate
|
||||||
|
* CryptSignAndEncryptMessage
|
||||||
|
* CryptSignCertificate
|
||||||
|
* CryptSignMessage
|
||||||
|
* CryptSignMessageWithKey
|
||||||
|
* CryptSIPAddProvider
|
||||||
|
* CryptSIPCreateIndirectData
|
||||||
|
* CryptSIPGetCaps
|
||||||
|
* CryptSIPGetSignedDataMsg
|
||||||
|
* CryptSIPLoad
|
||||||
|
* CryptSIPPutSignedDataMsg
|
||||||
|
* CryptSIPRemoveProvider
|
||||||
|
* CryptSIPRemoveSignedDataMsg
|
||||||
|
* CryptSIPRetrieveSubjectGuid
|
||||||
|
* CryptSIPRetrieveSubjectGuidForCatalogFile
|
||||||
|
* CryptSIPVerifyIndirectData
|
||||||
|
* CryptStringToBinaryA
|
||||||
|
* CryptStringToBinaryW
|
||||||
|
* CryptUninstallDefaultContext
|
||||||
|
* CryptUnprotectData
|
||||||
|
* CryptUnprotectMemory
|
||||||
|
* CryptUnregisterDefaultOIDFunction
|
||||||
|
* CryptUnregisterOIDFunction
|
||||||
|
* CryptUnregisterOIDInfo
|
||||||
|
* CryptUpdateProtectedState
|
||||||
|
* CryptVerifyCertificateSignature
|
||||||
|
* CryptVerifyCertificateSignatureEx
|
||||||
|
* CryptVerifyDetachedMessageHash
|
||||||
|
* CryptVerifyDetachedMessageSignature
|
||||||
|
* CryptVerifyMessageHash
|
||||||
|
* CryptVerifyMessageSignature
|
||||||
|
* CryptVerifyMessageSignatureWithKey
|
||||||
|
* CryptVerifyTimeStampSignature
|
||||||
|
* DbgInitOSS
|
||||||
|
* DbgPrintf
|
||||||
|
* PFXExportCertStore
|
||||||
|
* PFXExportCertStore2
|
||||||
|
* PFXExportCertStoreEx
|
||||||
|
* PFXImportCertStore
|
||||||
|
* PFXIsPFXBlob
|
||||||
|
* PFXVerifyPassword
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
3
winpr/libwinpr/crypto/module.def
Normal file
3
winpr/libwinpr/crypto/module.def
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
LIBRARY "libwinpr-crypto"
|
||||||
|
EXPORTS
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
# WinPR: Windows Portable Runtime
|
# WinPR: Windows Portable Runtime
|
||||||
# libwinpr-thread cmake build script
|
# libwinpr-pool cmake build script
|
||||||
#
|
#
|
||||||
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
# Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user