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
31
RsaKeyParamsInfo::checkKeySize
(uint32_t size)
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
42
RsaKeyParamsInfo::getDefaultSize
()
43
{
44
return
RSA_KEY_SIZES[0];
45
}
46
47
uint32_t
48
EcdsaKeyParamsInfo::checkKeySize
(uint32_t size)
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
60
EcdsaKeyParamsInfo::getDefaultSize
()
61
{
62
return
ECDSA_KEY_SIZES[0];
63
}
64
65
66
uint32_t
67
AesKeyParamsInfo::checkKeySize
(uint32_t size)
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
78
AesKeyParamsInfo::getDefaultSize
()
79
{
80
return
AES_KEY_SIZES[0];
81
}
82
83
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::AesKeyParamsInfo::checkKeySize
static uint32_t checkKeySize(uint32_t size)
check if size is qualified, otherwise return the default key size.
Definition:
key-params.cpp:67
key-params.hpp
ndn::AES_KEY_SIZES
static const uint32_t AES_KEY_SIZES[]
Definition:
key-params.cpp:28
ndn::EcdsaKeyParamsInfo::getDefaultSize
static uint32_t getDefaultSize()
Definition:
key-params.cpp:60
ndn::ECDSA_KEY_SIZES
static const uint32_t ECDSA_KEY_SIZES[]
Definition:
key-params.cpp:27
ndn::RsaKeyParamsInfo::checkKeySize
static uint32_t checkKeySize(uint32_t size)
check if size is qualified, otherwise return the default key size.
Definition:
key-params.cpp:31
ndn::RSA_KEY_SIZES
static const uint32_t RSA_KEY_SIZES[]
Definition:
key-params.cpp:26
ndn::EcdsaKeyParamsInfo::checkKeySize
static uint32_t checkKeySize(uint32_t size)
check if size is qualified, otherwise return the default key size.
Definition:
key-params.cpp:48
ndn::AesKeyParamsInfo::getDefaultSize
static uint32_t getDefaultSize()
Definition:
key-params.cpp:78
ndn::RsaKeyParamsInfo::getDefaultSize
static uint32_t getDefaultSize()
Definition:
key-params.cpp:42
ndnSIM
ndn-cxx
src
security
key-params.cpp
Generated on Wed Jan 11 2017 18:17:14 for ndnSIM by
1.8.13