src: Improving consistency and correcting code style
As of this commit, all data structures can be directly constructed from
wire format.
This commit excludes full correction of code style in security/ and
tools/ndnsec*, which will be part of a different commit.
Change-Id: I121ac1f81948bc7468990df52cdefeb2988d91a1
Refs: #1403
diff --git a/src/security/public-key.cpp b/src/security/public-key.cpp
index f6b2fdf..b9b7cf3 100644
--- a/src/security/public-key.cpp
+++ b/src/security/public-key.cpp
@@ -28,14 +28,14 @@
* @param algorithm The algorithm of the public key.
* @param keyDer The blob of the PublicKeyInfo in terms of DER.
*/
-PublicKey::PublicKey(const uint8_t *keyDerBuf, size_t keyDerSize)
+PublicKey::PublicKey(const uint8_t* keyDerBuf, size_t keyDerSize)
{
StringSource src(keyDerBuf, keyDerSize, true);
decode(src);
}
void
-PublicKey::encode(CryptoPP::BufferedTransformation &out) const
+PublicKey::encode(CryptoPP::BufferedTransformation& out) const
{
// SubjectPublicKeyInfo ::= SEQUENCE {
// algorithm AlgorithmIdentifier
@@ -45,7 +45,7 @@
}
void
-PublicKey::decode(CryptoPP::BufferedTransformation &in)
+PublicKey::decode(CryptoPP::BufferedTransformation& in)
{
// SubjectPublicKeyInfo ::= SEQUENCE {
// algorithm AlgorithmIdentifier
@@ -86,7 +86,7 @@
key_.assign(out.begin(), out.end());
}
- catch (CryptoPP::BERDecodeErr &err) {
+ catch (CryptoPP::BERDecodeErr& err) {
throw Error("PublicKey decoding error");
}
}
@@ -97,15 +97,15 @@
// if (digestAlgorithm == DIGEST_ALGORITHM_SHA256) {
// uint8_t digest[SHA256_DIGEST_LENGTH];
// ndn_digestSha256(keyDer_.buf(), keyDer_.size(), digest);
-
+
// return Blob(digest, sizeof(digest));
// }
// else
// throw UnrecognizedDigestAlgorithmException("Wrong format!");
// }
-std::ostream &
-operator <<(std::ostream &os, const PublicKey &key)
+std::ostream&
+operator <<(std::ostream& os, const PublicKey& key)
{
CryptoPP::StringSource(key.get().buf(), key.get().size(), true,
new CryptoPP::Base64Encoder(new CryptoPP::FileSink(os), true, 64));