global: Rename unsigned char to uint8, DynamicUCharArray to DynamicUInt8Array and DynamicUCharVector to DynamicUInt8Vector.
diff --git a/ndn-cpp/security/certificate/public-key.cpp b/ndn-cpp/security/certificate/public-key.cpp
index 1f64c07..3565ac3 100644
--- a/ndn-cpp/security/certificate/public-key.cpp
+++ b/ndn-cpp/security/certificate/public-key.cpp
@@ -32,7 +32,7 @@
PublicKey::fromDer(const Blob& keyDer)
{
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = keyDer.buf();
+ const uint8_t *derPointer = keyDer.buf();
RSA *publicKey = d2i_RSA_PUBKEY(NULL, &derPointer, keyDer.size());
if (!publicKey)
throw UnrecognizedKeyFormatException("Error decoding public key DER");
@@ -45,7 +45,7 @@
PublicKey::getDigest(DigestAlgorithm digestAlgorithm) const
{
if (digestAlgorithm == DIGEST_ALGORITHM_SHA256) {
- unsigned char digest[SHA256_DIGEST_LENGTH];
+ uint8_t digest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(keyDer_.buf(), keyDer_.size(), digest);
return Blob(digest, sizeof(digest));
diff --git a/ndn-cpp/security/identity/memory-private-key-storage.cpp b/ndn-cpp/security/identity/memory-private-key-storage.cpp
index 56054af..0fef285 100644
--- a/ndn-cpp/security/identity/memory-private-key-storage.cpp
+++ b/ndn-cpp/security/identity/memory-private-key-storage.cpp
@@ -19,7 +19,7 @@
}
void MemoryPrivateKeyStorage::setKeyPairForKeyName
- (const Name& keyName, unsigned char *publicKeyDer, size_t publicKeyDerLength, unsigned char *privateKeyDer,
+ (const Name& keyName, uint8_t *publicKeyDer, size_t publicKeyDerLength, uint8_t *privateKeyDer,
size_t privateKeyDerLength)
{
publicKeyStore_[keyName.toUri()] = PublicKey::fromDer(Blob(publicKeyDer, publicKeyDerLength));
@@ -44,15 +44,15 @@
}
Blob
-MemoryPrivateKeyStorage::sign(const unsigned char *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm)
+MemoryPrivateKeyStorage::sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm)
{
if (digestAlgorithm != DIGEST_ALGORITHM_SHA256)
return Blob();
- unsigned char digest[SHA256_DIGEST_LENGTH];
+ uint8_t digest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(data, dataLength, digest);
// TODO: use RSA_size to get the proper size of the signature buffer.
- unsigned char signatureBits[1000];
+ uint8_t signatureBits[1000];
unsigned int signatureBitsLength;
// Find the private key and sign.
@@ -66,7 +66,7 @@
}
Blob
-MemoryPrivateKeyStorage::decrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric)
+MemoryPrivateKeyStorage::decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric)
{
#if 1
throw std::runtime_error("MemoryPrivateKeyStorage::decrypt not implemented");
@@ -74,7 +74,7 @@
}
Blob
-MemoryPrivateKeyStorage::encrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric)
+MemoryPrivateKeyStorage::encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric)
{
#if 1
throw std::runtime_error("MemoryPrivateKeyStorage::encrypt not implemented");
@@ -101,10 +101,10 @@
return false;
}
-MemoryPrivateKeyStorage::RsaPrivateKey::RsaPrivateKey(unsigned char *keyDer, size_t keyDerLength)
+MemoryPrivateKeyStorage::RsaPrivateKey::RsaPrivateKey(uint8_t *keyDer, size_t keyDerLength)
{
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = keyDer;
+ const uint8_t *derPointer = keyDer;
privateKey_ = d2i_RSAPrivateKey(NULL, &derPointer, keyDerLength);
if (!privateKey_)
throw SecurityException("RsaPrivateKey constructor: Error decoding private key DER");
diff --git a/ndn-cpp/security/identity/memory-private-key-storage.hpp b/ndn-cpp/security/identity/memory-private-key-storage.hpp
index d97d2a8..b44f2ba 100644
--- a/ndn-cpp/security/identity/memory-private-key-storage.hpp
+++ b/ndn-cpp/security/identity/memory-private-key-storage.hpp
@@ -36,7 +36,7 @@
* @param privateKeyDerLength The length of privateKeyDer.
*/
void setKeyPairForKeyName
- (const Name& keyName, unsigned char *publicKeyDer, size_t publicKeyDerLength, unsigned char *privateKeyDer,
+ (const Name& keyName, uint8_t *publicKeyDer, size_t publicKeyDerLength, uint8_t *privateKeyDer,
size_t privateKeyDerLength);
/**
@@ -65,7 +65,7 @@
* @return The signature, or a null pointer if signing fails.
*/
virtual Blob
- sign(const unsigned char *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
+ sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm);
/**
* Decrypt data.
@@ -76,7 +76,7 @@
* @return The decrypted data.
*/
virtual Blob
- decrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric);
+ decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric);
/**
* Encrypt data.
@@ -87,7 +87,7 @@
* @return The encrypted data.
*/
virtual Blob
- encrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric);
+ encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric);
/**
* @brief Generate a symmetric key.
@@ -113,7 +113,7 @@
*/
class RsaPrivateKey {
public:
- RsaPrivateKey(unsigned char *keyDer, size_t keyDerLength);
+ RsaPrivateKey(uint8_t *keyDer, size_t keyDerLength);
~RsaPrivateKey();
diff --git a/ndn-cpp/security/identity/private-key-storage.hpp b/ndn-cpp/security/identity/private-key-storage.hpp
index 3b71d37..0e24eec 100644
--- a/ndn-cpp/security/identity/private-key-storage.hpp
+++ b/ndn-cpp/security/identity/private-key-storage.hpp
@@ -50,7 +50,7 @@
* @return The signature, or a null pointer if signing fails.
*/
virtual Blob
- sign(const unsigned char *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) = 0;
+ sign(const uint8_t *data, unsigned int dataLength, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256) = 0;
Blob
sign(const Blob& data, const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256)
@@ -67,7 +67,7 @@
* @return The decrypted data.
*/
virtual Blob
- decrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric = false) = 0;
+ decrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric = false) = 0;
Blob
decrypt(const Name& keyName, const Blob& data, bool isSymmetric = false)
@@ -84,7 +84,7 @@
* @return The encrypted data.
*/
virtual Blob
- encrypt(const Name& keyName, const unsigned char* data, unsigned int dataLength, bool isSymmetric = false) = 0;
+ encrypt(const Name& keyName, const uint8_t* data, unsigned int dataLength, bool isSymmetric = false) = 0;
Blob
encrypt(const Name& keyName, const Blob& data, bool isSymmetric = false)
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index 85df172..fdfc998 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -18,7 +18,7 @@
namespace ndn {
#if 1
-static unsigned char DEFAULT_PUBLIC_KEY_DER[] = {
+static uint8_t DEFAULT_PUBLIC_KEY_DER[] = {
0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81,
0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xE1, 0x7D, 0x30, 0xA7, 0xD8, 0x28, 0xAB, 0x1B, 0x84, 0x0B, 0x17,
0x54, 0x2D, 0xCA, 0xF6, 0x20, 0x7A, 0xFD, 0x22, 0x1E, 0x08, 0x6B, 0x2A, 0x60, 0xD1, 0x6C, 0xB7, 0xF5, 0x44, 0x48, 0xBA,
@@ -78,17 +78,17 @@
if (!data.getWireEncoding())
// Don't expect this to happen
throw SecurityException("The Data wireEncoding is null.");
- unsigned char signedPortionDigest[SHA256_DIGEST_LENGTH];
+ uint8_t signedPortionDigest[SHA256_DIGEST_LENGTH];
ndn_digestSha256(data.getWireEncoding().signedBuf(), data.getWireEncoding().signedSize(), signedPortionDigest);
// Verify the signedPortionDigest.
// Use a temporary pointer since d2i updates it.
- const unsigned char *derPointer = DEFAULT_PUBLIC_KEY_DER;
+ const uint8_t *derPointer = DEFAULT_PUBLIC_KEY_DER;
RSA *publicKey = d2i_RSA_PUBKEY(NULL, &derPointer, sizeof(DEFAULT_PUBLIC_KEY_DER));
if (!publicKey)
throw UnrecognizedKeyFormatException("Error decoding public key in d2i_RSAPublicKey");
int success = RSA_verify
- (NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), (unsigned char *)signature->getSignature().buf(),
+ (NID_sha256, signedPortionDigest, sizeof(signedPortionDigest), (uint8_t *)signature->getSignature().buf(),
signature->getSignature().size(), publicKey);
// Free the public key before checking for success.
RSA_free(publicKey);