NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
key-params.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #include "key-params.hpp"
23 
24 namespace ndn {
25 
26 static const uint32_t RSA_KEY_SIZES[] = {2048, 1024};
27 static const uint32_t ECDSA_KEY_SIZES[] = {256, 384};
28 static const uint32_t AES_KEY_SIZES[] = {64, 128, 256};
29 
30 uint32_t
32 {
33  for (size_t i = 0; i < (sizeof(RSA_KEY_SIZES) / sizeof(uint32_t)); i++)
34  {
35  if (RSA_KEY_SIZES[i] == size)
36  return size;
37  }
38  return getDefaultSize();
39 }
40 
41 uint32_t
43 {
44  return RSA_KEY_SIZES[0];
45 }
46 
47 uint32_t
49 {
50 
51  for (size_t i = 0; i < (sizeof(ECDSA_KEY_SIZES) / sizeof(uint32_t)); i++)
52  {
53  if (ECDSA_KEY_SIZES[i] == size)
54  return size;
55  }
56  return getDefaultSize();
57 }
58 
59 uint32_t
61 {
62  return ECDSA_KEY_SIZES[0];
63 }
64 
65 
66 uint32_t
68 {
69  for (size_t i = 0; i < (sizeof(AES_KEY_SIZES) / sizeof(uint32_t)); i++)
70  {
71  if (AES_KEY_SIZES[i] == size)
72  return size;
73  }
74  return getDefaultSize();
75 }
76 
77 uint32_t
79 {
80  return AES_KEY_SIZES[0];
81 }
82 
83 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
static uint32_t checkKeySize(uint32_t size)
check if size is qualified, otherwise return the default key size.
Definition: key-params.cpp:67
static const uint32_t AES_KEY_SIZES[]
Definition: key-params.cpp:28
static uint32_t getDefaultSize()
Definition: key-params.cpp:60
static const uint32_t ECDSA_KEY_SIZES[]
Definition: key-params.cpp:27
static uint32_t checkKeySize(uint32_t size)
check if size is qualified, otherwise return the default key size.
Definition: key-params.cpp:31
static const uint32_t RSA_KEY_SIZES[]
Definition: key-params.cpp:26
static uint32_t checkKeySize(uint32_t size)
check if size is qualified, otherwise return the default key size.
Definition: key-params.cpp:48
static uint32_t getDefaultSize()
Definition: key-params.cpp:78
static uint32_t getDefaultSize()
Definition: key-params.cpp:42