///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
// All rights reserved.
//
// This software and its documentation and related materials are owned by
// the Alliance. The software may only be incorporated into application
// programs owned by members of the Alliance, subject to a signed
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable
// trade secrets of the Alliance and its suppliers. The software is also
// protected by copyright law and international treaty provisions. Application
// programs incorporating this software must include the following statement
// with their copyright notices:
//
// This application incorporates Open Design Alliance software pursuant to a license
// agreement with Open Design Alliance.
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
// All rights reserved.
//
// By use of this software, its documentation or related materials, you
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
#ifndef _DAI_SIGNATURE_SERVICES_H_
#define _DAI_SIGNATURE_SERVICES_H_
#include "OdaCommon.h"
#include "RxObjectImpl.h"
#include "RxValue.h"
#include "OdCryptoServices/OdCryptoServices.h"
#include "daiBuildOptions.h"
#include "daiSignature.h"
#include "TD_PackPush.h"
/** \details
Implements the Data Access Interface (DAI) that provides functionality for manipulating data that is defined within the EXPRESS SCHEMA format.
*/
namespace OdDAI {
/** \details
The class defining the interface of signature services.
*/
class DAI_EXPORT SignatureServices : public OdRxObject
{
public:
//DOM-IGNORE-BEGIN
ODRX_DECLARE_MEMBERS(SignatureServices);
//DOM-IGNORE-END
/** \details
Prints certificate in Base64 encoding.
\param pCert [in] A pointer to the object.
\param certString [out] A string containing result.
\returns returns true if certificate was printed succesfully and false otherwise.
*/
virtual bool printCert(const OdCertificateObjectPtr pCert, OdAnsiString& certString) const = 0;
/** \details
Decodes certificate from Base64 encoding.
\param certString [in] A string containing Base64 encoded certificate.
\param pCert [out] A pointer to the object.
\returns returns true if certificate was decoded successfully and false otherwise.
*/
virtual bool decodeCert(const OdAnsiString& certString, OdCertificateObjectPtr& pCert) const = 0;
/** \details
Extracts the hash algorithm from the certificate's signature algorithm.
\param pCert [in] A pointer to the certificate object.
\returns returns the hash algorithm used by the certificate, defaults to kSHA1 if unable to determine.
*/
virtual OdSignatureHashAlgorithm getHashAlgorithmFromCert(const OdCertificateObjectPtr pCert) const = 0;
/** \details
Sets parameters for alternative certificate storage.
\param allowSelfSigned [in] flag to allow using self-signed certificates.
\param useAltStore [in] flag to allow using alternative certificate storage.
\param altCertsDir [in] path to the directory where PEM certificates are located.
\param altPrivDir [in] path to the directory where PEM private keys are located.
\param altStoreCadirChosen [in] flag to allow using alternative CA certificates storage.
\param altCaDir [in] path to the directory where trusted CA certificates are located.
\param altStoreCabundleChosen [in] flag to allow using alternative CA bundle.
\param altCaBundle [in] path to the CA bundle file.
\returns returns true if parameters setting was succesfull and false otherwise.
\remarks
All parameters will be reset with each subsequent call.
*/
virtual bool setAlternativeCertificateStore(
bool allowSelfSigned = false,
bool useAltStore = false,
const OdString& altCertsDir = L"",
const OdString& altPrivDir = L"",
bool altStoreCadirChosen = false,
const OdString& altCaDir = L"",
bool altStoreCabundleChosen = false,
const OdString& altCaBundle = L"") = 0;
/** \details
Clears parameters for alternative certificate storage.
*/
virtual void clearAlternativeCertificateStore() = 0;
/** \details
Retrieves the value of the crypto services corresponding to the alternative certificate storage.
\returns returns a const OdCryptoServicesPtr that contains crypto services value.
*/
virtual const OdCryptoServicesPtr getCryptoServices() const = 0;
/** \details
Retrieves the value of the crypto services corresponding to the alternative certificate storage.
\returns returns an OdCryptoServicesPtr that contains crypto services value.
*/
virtual OdCryptoServicesPtr getCryptoServices() = 0;
/** \details
Signs a file with the specified signature section.
\param inputFileName [in] The path of the input file to sign.
\param outputFileName [in] The path of the output signed file.
\param signatureSection [in] An array of signature section data.
\returns eOk if the file was successfully signed; otherwise, the method returns an appropriate error code.
*/
virtual OdResult signFile(const OdString& inputFileName, const OdString& outputFileName, OdArray& signatureSection) const = 0;
//DOM-IGNORE-BEGIN
protected:
//DOM-IGNORE-END
};
/** \details
A data type that represents a smart pointer to a .
*/
typedef OdSmartPtr SignatureServicesPtr;
}
#include "TD_PackPop.h"
#endif // _DAI_SIGNATURE_SERVICES_H_