DCMTK  Version 3.6.7
OFFIS DICOM Toolkit
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SiPKEY Class Reference

This class implements all supported public key crypto algorithms using the OpenSSL EVP_PKEY high level API. More...

+ Inheritance diagram for SiPKEY:

Public Member Functions

 SiPKEY (EVP_PKEY *key, OFBool owned)
 constructor More...
 
virtual ~SiPKEY ()
 destructor
 
virtual OFCondition sign (const unsigned char *inputHash, unsigned long inputHashSize, E_MACType inputHashAlgorithm, unsigned char *outputSignature, unsigned long &outputSignatureSize)
 creates a signature. More...
 
virtual OFCondition verify (const unsigned char *inputHash, unsigned long inputHashSize, E_MACType inputHashAlgorithm, const unsigned char *inputSignature, unsigned long inputSignatureSize, OFBool &verified)
 verifies a signature. More...
 
virtual unsigned long getSize () const
 returns the size of a block of encrypted/decrypted ciphertext in bytes. More...
 
virtual E_KeyType keyType () const
 returns the type of public key algorithm computed by this object More...
 
- Public Member Functions inherited from SiAlgorithm
 SiAlgorithm ()
 default constructor
 
virtual ~SiAlgorithm ()
 destructor
 

Private Member Functions

 SiPKEY (SiPKEY &arg)
 private undefined copy constructor
 
SiPKEYoperator= (SiPKEY &arg)
 private undefined copy assignment operator
 

Private Attributes

EVP_PKEY * signing_key
 key used for signature/verification
 
OFBool owned_
 indicates if the signing key object is owned by this instance.
 

Detailed Description

This class implements all supported public key crypto algorithms using the OpenSSL EVP_PKEY high level API.

Remarks
this class is only available if DCMTK is compiled with OpenSSL support enabled.

Constructor & Destructor Documentation

◆ SiPKEY()

SiPKEY::SiPKEY ( EVP_PKEY *  key,
OFBool  owned 
)

constructor

Parameters
keypointer to public or private key
ownedif true, ownership of the key is transferred to the SiPKEY instance

Member Function Documentation

◆ getSize()

virtual unsigned long SiPKEY::getSize ( ) const
virtual

returns the size of a block of encrypted/decrypted ciphertext in bytes.

The result depends on the public key algorithm, key size and padding scheme. In general the input to decrypt() or encrypt() must be less than or equal to this block size. The output of decrypt() or encrypt() is always equal to this block size.

Returns
block size for this public key cryptosystem and key

Implements SiAlgorithm.

◆ keyType()

virtual E_KeyType SiPKEY::keyType ( ) const
virtual

returns the type of public key algorithm computed by this object

Returns
type of public key algorithm

Implements SiAlgorithm.

◆ sign()

virtual OFCondition SiPKEY::sign ( const unsigned char *  inputHash,
unsigned long  inputHashSize,
E_MACType  inputHashAlgorithm,
unsigned char *  outputSignature,
unsigned long &  outputSignatureSize 
)
virtual

creates a signature.

Parameters
inputHasharray of hash key bytes that are to be signed
inputHashSizelength of hash key array in bytes
inputHashAlgorithmMAC algorithm used for creation of hash key. Required for creation of PKCS#1 RSA signature padding.
outputSignaturepointer to array of at least getSize() which must be allocated by caller.
outputSignatureSizereturns the number of bytes written to outputSignature.
Returns
SI_EC_Normal if successful, errorcode otherwise.

Implements SiAlgorithm.

◆ verify()

virtual OFCondition SiPKEY::verify ( const unsigned char *  inputHash,
unsigned long  inputHashSize,
E_MACType  inputHashAlgorithm,
const unsigned char *  inputSignature,
unsigned long  inputSignatureSize,
OFBool &  verified 
)
virtual

verifies a signature.

Parameters
inputHasharray of bytes containing hash key to be verified against signature
inputHashSizelength of hash key array in bytes
inputHashAlgorithmMAC algorithm used for creation of hash key. Required for creation of PKCS#1 RSA signature padding.
inputSignaturearray of bytes containing signature to be verified
inputSignatureSizelength of signature array in bytes
verifiedreturns whether the signature was successfully verified
Returns
SI_EC_Normal if successful, errorcode otherwise.

Implements SiAlgorithm.


The documentation for this class was generated from the following file:


Generated on Thu Apr 28 2022 for DCMTK Version 3.6.7 by Doxygen 1.9.1