Virgil Security Crypto library  2.4.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Classes | Public Member Functions | List of all members
virgil::crypto::VirgilContentInfo Class Reference

#include <VirgilContentInfo.h>

Inheritance diagram for virgil::crypto::VirgilContentInfo:
virgil::crypto::foundation::asn1::VirgilAsn1Compatible

Public Member Functions

 VirgilContentInfo ()
 PIMPL initialization.
 
VirgilAsn1Compatible implementation
Marshalling format:
VirgilContentInfo ::= SEQUENCE {
version ::= INTEGER { v0(0) },
cmsContent ContentInfo, -- Imports from RFC 5652
customParams [0] IMPLICIT VirgilCustomParams OPTIONAL
}
size_t asn1Write (virgil::crypto::foundation::asn1::VirgilAsn1Writer &asn1Writer, size_t childWrittenBytes=0) const override
 Write object state to the writer. More...
 
void asn1Read (virgil::crypto::foundation::asn1::VirgilAsn1Reader &asn1Reader) override
 Read object state from the reader. More...
 
Recipient management
void addKeyRecipient (const VirgilByteArray &recipientId, const VirgilByteArray &publicKey)
 Add recipient defined with id and public key. More...
 
bool hasKeyRecipient (const VirgilByteArray &recipientId) const
 Check whether recipient with given identifier exists. More...
 
void removeKeyRecipient (const VirgilByteArray &recipientId)
 Remove recipient with given identifier. More...
 
void removeKeyRecipients ()
 Remove all recipients defined with identifier.
 
void addPasswordRecipient (const VirgilByteArray &pwd)
 Add recipient defined with password. More...
 
bool hasPasswordRecipient (const VirgilByteArray &password) const
 Check whether recipient with given password exists. More...
 
void removePasswordRecipient (const VirgilByteArray &pwd)
 Remove recipient with given password. More...
 
void removePasswordRecipients ()
 Remove all recipients defined with password.
 
void removeAllRecipients ()
 Remove all recipients.
 
Custom parameters Access / Management

Custom parameters is a structure that contains additional user defined information about encrypted data.

Note
This information is stored as part of the content info in unencrypted format.
VirgilCustomParams & customParams ()
 Provide access to the object that handles custom parameters. More...
 
const VirgilCustomParams & customParams () const
 Provide readonly access to the object that handles custom parameters. More...
 
- Public Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible
virgil::crypto::VirgilByteArray toAsn1 () const
 Save object state to the ASN.1 structure.
 
void fromAsn1 (const virgil::crypto::VirgilByteArray &asn1)
 Restore object state from the ASN.1 structure.
 
virtual ~VirgilAsn1Compatible () noexcept
 Polymorphic destructor.
 

Static Public Member Functions

Helpers
static size_t defineSize (const VirgilByteArray &contentInfoData)
 

Encrypted content management

Note
Designed for internal use only.
class VirgilCipherBase
 

Additional Inherited Members

- Protected Member Functions inherited from virgil::crypto::foundation::asn1::VirgilAsn1Compatible
virtual void checkRequiredField (const VirgilByteArray &param) const
 If given parameter is empty exception will be thrown. More...
 

Detailed Description

High level API to the VirgilContentInfo structure.

Member Function Documentation

void virgil::crypto::VirgilContentInfo::addKeyRecipient ( const VirgilByteArray &  recipientId,
const VirgilByteArray &  publicKey 
)

Add recipient defined with id and public key.

Parameters
recipientIdRecipient's unique identifier, MUST not be empty.
publicKeyRecipient's public key, MUST not be empty.
Exceptions
VirgilCryptoExceptionwith VirgilCryptoErrorCode::InvalidArgument, if invalid arguments are given.
void virgil::crypto::VirgilContentInfo::addPasswordRecipient ( const VirgilByteArray &  pwd)

Add recipient defined with password.

Use it for password based encryption.

Parameters
pwdRecipient's password, MUST not be empty.
Exceptions
VirgilCryptoExceptionwith VirgilCryptoErrorCode::InvalidArgument, if empty argument are given.
void virgil::crypto::VirgilContentInfo::asn1Read ( virgil::crypto::foundation::asn1::VirgilAsn1Reader &  asn1Reader)
overridevirtual

Read object state from the reader.

Parameters
asn1Readerreader payloaded with ASN.1 to be read.

Implements virgil::crypto::foundation::asn1::VirgilAsn1Compatible.

size_t virgil::crypto::VirgilContentInfo::asn1Write ( virgil::crypto::foundation::asn1::VirgilAsn1Writer &  asn1Writer,
size_t  childWrittenBytes = 0 
) const
overridevirtual

Write object state to the writer.

Parameters
asn1Writerwriter that should be payloaded by subclasses.
childWrittenBytescount of bytes that was written by subclasses.
Returns
Writen bytes count.

Implements virgil::crypto::foundation::asn1::VirgilAsn1Compatible.

VirgilCustomParams& virgil::crypto::VirgilContentInfo::customParams ( )

Provide access to the object that handles custom parameters.

Note
Use this method to add custom parameters to the content info object.
Use this method before encryption process.
const VirgilCustomParams& virgil::crypto::VirgilContentInfo::customParams ( ) const

Provide readonly access to the object that handles custom parameters.

Note
Use this method to read custom parameters from the content info object.
bool virgil::crypto::VirgilContentInfo::hasKeyRecipient ( const VirgilByteArray &  recipientId) const

Check whether recipient with given identifier exists.

Search order:

  1. Local structures - useful when cipher is used for encryption.
  2. ContentInfo structure - useful when cipher is used for decryption.
Parameters
recipientIdRecipient's unique identifier.
Returns
true if recipient with given identifier exists, false - otherwise.
bool virgil::crypto::VirgilContentInfo::hasPasswordRecipient ( const VirgilByteArray &  password) const

Check whether recipient with given password exists.

Search order:

  1. Local structures - useful when cipher is used for encryption.
Parameters
passwordRecipient's unique identifier.
Returns
true if recipient with given password exists, false - otherwise.
void virgil::crypto::VirgilContentInfo::removeKeyRecipient ( const VirgilByteArray &  recipientId)

Remove recipient with given identifier.

Parameters
recipientIdRecipient's unique identifier.
Note
If recipient with given identifier is absent - do nothing.
void virgil::crypto::VirgilContentInfo::removePasswordRecipient ( const VirgilByteArray &  pwd)

Remove recipient with given password.

Note
If recipient with given password is absent - do nothing.

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