encrypt-params-lite.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_ENCRYPT_PARAMS_LITE_HPP
24 #define NDN_ENCRYPT_PARAMS_LITE_HPP
25 
26 #include "../../util/blob-lite.hpp"
27 #include "../../../c/encrypt/algo/encrypt-params-types.h"
28 
29 namespace ndn {
30 
37 public:
42 
47  ndn_EncryptAlgorithmType
48  getAlgorithmType() const { return algorithmType; }
49 
54  const BlobLite&
55  getInitialVector() const { return BlobLite::downCast(initialVector); }
56 
63  setAlgorithmType(ndn_EncryptAlgorithmType algorithmType)
64  {
65  this->algorithmType = algorithmType;
66  return *this;
67  }
68 
76  setInitialVector(const BlobLite& initialVector)
77  {
78  BlobLite::downCast(this->initialVector) = initialVector;
79  return *this;
80  }
81 
87  static EncryptParamsLite&
88  downCast(ndn_EncryptParams& encryptParams) { return *(EncryptParamsLite*)&encryptParams; }
89 
90  static const EncryptParamsLite&
91  downCast(const ndn_EncryptParams& encryptParams) { return *(EncryptParamsLite*)&encryptParams; }
92 };
93 
94 }
95 
96 #endif
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
static EncryptParamsLite & downCast(ndn_EncryptParams &encryptParams)
Downcast the reference to the ndn_EncryptParams struct to an EncryptParamsLite.
Definition: encrypt-params-lite.hpp:88
An EncryptParamsLite holds an algorithm type and other parameters used to encrypt and decrypt...
Definition: encrypt-params-lite.hpp:36
ndn_EncryptAlgorithmType algorithmType
-1 for none
Definition: encrypt-params-types.h:45
EncryptParamsLite & setAlgorithmType(ndn_EncryptAlgorithmType algorithmType)
Set the algorithm type.
Definition: encrypt-params-lite.hpp:63
static BlobLite & downCast(ndn_Blob &blob)
Downcast the reference to the ndn_Blob struct to a BlobLite.
Definition: blob-lite.hpp:76
const BlobLite & getInitialVector() const
Get the initial vector.
Definition: encrypt-params-lite.hpp:55
A BlobLite holds a pointer to an immutable pre-allocated buffer and its length This is like a JavaScr...
Definition: blob-lite.hpp:37
ndn_EncryptAlgorithmType getAlgorithmType() const
Get the algorithm type.
Definition: encrypt-params-lite.hpp:48
An ndn_EncryptParams holds an algorithm type and other parameters used to encrypt and decrypt...
Definition: encrypt-params-types.h:44
EncryptParamsLite()
Create an EncryptParamsLite with defaults for all the values.
Definition: encrypt-params-lite.cpp:28
EncryptParamsLite & setInitialVector(const BlobLite &initialVector)
Set the initial vector.
Definition: encrypt-params-lite.hpp:76