lime
Lime is a C++ library implementing Open Whisper System Signal protocol
Public Types | Public Member Functions | Static Public Member Functions | List of all members
lime::SignedPreKey< Algo, true > Struct Template Reference

Public Types

using serializedBuffer = sBuffer< X< Algo, lime::Xtype::publicKey >::ssize()+X< Algo, lime::Xtype::privateKey >::ssize()+K< Algo, lime::Ktype::publicKey >::ssize()+K< Algo, lime::Ktype::privateKey >::ssize()>
 

Public Member Functions

 SignedPreKey (const X< typename Algo::EC, lime::Xtype::publicKey > &SPk_EC_Public, const X< typename Algo::EC, lime::Xtype::privateKey > &SPk_EC_Private, const K< typename Algo::KEM, lime::Ktype::publicKey > &SPk_KEM_Public, const K< typename Algo::KEM, lime::Ktype::privateKey > &SPk_KEM_Private)
 
 SignedPreKey ()
 
 SignedPreKey (const serializedBuffer &SPk, uint32_t Id)
 Unserializing constructor: from data read in DB. More...
 
 SignedPreKey (const std::vector< uint8_t >::const_iterator s)
 Unserializing constructor: from data read in received bundle: EC public key || KEM public key || Id || signature. More...
 
const X< typename Algo::EC, lime::Xtype::privateKey > & cECprivateKey (void) const
 accessors More...
 
const X< typename Algo::EC, lime::Xtype::publicKey > & cECpublicKey (void) const
 
const K< typename Algo::KEM, lime::Ktype::privateKey > & cKEMprivateKey (void) const
 
const K< typename Algo::KEM, lime::Ktype::publicKey > & cKEMpublicKey (void) const
 
const DSA< typename Algo::EC, lime::DSAtype::signature > & csignature (void) const
 
DSA< typename Algo::EC, lime::DSAtype::signature > & signature (void)
 
const Xpair< typename Algo::EC > & cECKeypair (void) const
 
const Kpair< typename Algo::KEM > & cKEMKeypair (void) const
 
uint32_t get_Id (void) const
 
void set_Id (uint32_t Id)
 
serializedBuffer serialize (void) const
 Serialize the key pair (to store in DB): EC public || EC private || KEM public || KEM private. More...
 
std::vector< uint8_t > serializePublic (bool signedMessage=false) const
 
void dump (std::ostringstream &os, std::string indent=" ") const
 Dump the public key, signature and Id. More...
 

Static Public Member Functions

static constexpr size_t serializedPublicSize (void)
 
static constexpr size_t serializedSize (void)
 

Member Typedef Documentation

template<typename Algo >
using lime::SignedPreKey< Algo, true >::serializedBuffer = sBuffer< X<Algo, lime::Xtype::publicKey>::ssize() + X<Algo, lime::Xtype::privateKey>::ssize() + K<Algo, lime::Ktype::publicKey>::ssize() + K<Algo, lime::Ktype::privateKey>::ssize()>

Constructor & Destructor Documentation

template<typename Algo >
lime::SignedPreKey< Algo, true >::SignedPreKey ( const X< typename Algo::EC, lime::Xtype::publicKey > &  SPk_EC_Public,
const X< typename Algo::EC, lime::Xtype::privateKey > &  SPk_EC_Private,
const K< typename Algo::KEM, lime::Ktype::publicKey > &  SPk_KEM_Public,
const K< typename Algo::KEM, lime::Ktype::privateKey > &  SPk_KEM_Private 
)
inline
template<typename Algo >
lime::SignedPreKey< Algo, true >::SignedPreKey ( )
inline
template<typename Algo >
lime::SignedPreKey< Algo, true >::SignedPreKey ( const serializedBuffer SPk,
uint32_t  Id 
)
inline

Unserializing constructor: from data read in DB.

template<typename Algo >
lime::SignedPreKey< Algo, true >::SignedPreKey ( const std::vector< uint8_t >::const_iterator  s)
inline

Unserializing constructor: from data read in received bundle: EC public key || KEM public key || Id || signature.

Member Function Documentation

template<typename Algo >
const Xpair<typename Algo::EC>& lime::SignedPreKey< Algo, true >::cECKeypair ( void  ) const
inline
template<typename Algo >
const X<typename Algo::EC, lime::Xtype::privateKey>& lime::SignedPreKey< Algo, true >::cECprivateKey ( void  ) const
inline

accessors

template<typename Algo >
const X<typename Algo::EC, lime::Xtype::publicKey>& lime::SignedPreKey< Algo, true >::cECpublicKey ( void  ) const
inline
template<typename Algo >
const Kpair<typename Algo::KEM>& lime::SignedPreKey< Algo, true >::cKEMKeypair ( void  ) const
inline
template<typename Algo >
const K<typename Algo::KEM, lime::Ktype::privateKey>& lime::SignedPreKey< Algo, true >::cKEMprivateKey ( void  ) const
inline
template<typename Algo >
const K<typename Algo::KEM, lime::Ktype::publicKey>& lime::SignedPreKey< Algo, true >::cKEMpublicKey ( void  ) const
inline
template<typename Algo >
const DSA<typename Algo::EC, lime::DSAtype::signature>& lime::SignedPreKey< Algo, true >::csignature ( void  ) const
inline
template<typename Algo >
void lime::SignedPreKey< Algo, true >::dump ( std::ostringstream &  os,
std::string  indent = "        " 
) const
inline

Dump the public key, signature and Id.

template<typename Algo >
uint32_t lime::SignedPreKey< Algo, true >::get_Id ( void  ) const
inline
template<typename Algo >
serializedBuffer lime::SignedPreKey< Algo, true >::serialize ( void  ) const
inline

Serialize the key pair (to store in DB): EC public || EC private || KEM public || KEM private.

template<typename Algo >
static constexpr size_t lime::SignedPreKey< Algo, true >::serializedPublicSize ( void  )
inlinestatic

Serializing:

  • public is publicKey EC || publicKey KEM || signature || Id (4bytes) -> used to publish
  • storage publicKey EC || privateKey EC || publicKey KEM || privateKey KEM -> used to store in DB, Id is stored separately
template<typename Algo >
static constexpr size_t lime::SignedPreKey< Algo, true >::serializedSize ( void  )
inlinestatic
template<typename Algo >
std::vector<uint8_t> lime::SignedPreKey< Algo, true >::serializePublic ( bool  signedMessage = false) const
inline

Serialize the public keys, signature and Id to publish on the server

Parameters
[in]signedMessagewhen true return the message (to be)signed - in this case EC public key || KEM public key
Returns
the serialized public value: either the public part to be signed, or the whole bundle: EC public key || KEM public key || signature || Id
template<typename Algo >
void lime::SignedPreKey< Algo, true >::set_Id ( uint32_t  Id)
inline
template<typename Algo >
DSA<typename Algo::EC, lime::DSAtype::signature>& lime::SignedPreKey< Algo, true >::signature ( void  )
inline

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