change rsa padding schema in GroupManager to OAEP
Change-Id: Idfbe4b89237db9474e7c8d02be080caae1320838
diff --git a/src/group-manager.cpp b/src/group-manager.cpp
index 64a4e8c..345eb79 100644
--- a/src/group-manager.cpp
+++ b/src/group-manager.cpp
@@ -163,7 +163,6 @@
{
RandomNumberGenerator rng;
RsaKeyParams params(m_paramLength);
- algo::EncryptParams eparams(tlv::AlgorithmRsaPkcs);
DecryptKey<algo::Rsa> privateKey = algo::Rsa::generateKey(rng, params);
priKeyBuf = privateKey.getKeyBits();
EncryptKey<algo::Rsa> publicKey = algo::Rsa::deriveEncryptKey(priKeyBuf);
@@ -194,7 +193,7 @@
name.append(startTs).append(endTs);
Data data = Data(name);
data.setFreshnessPeriod(time::hours(m_freshPeriod));
- algo::EncryptParams eparams(tlv::AlgorithmRsaPkcs);
+ algo::EncryptParams eparams(tlv::AlgorithmRsaOaep);
algo::encryptData(data, priKeyBuf.buf(), priKeyBuf.size(), keyName,
certKey.buf(), certKey.size(), eparams);
m_keyChain.sign(data);
diff --git a/tests/unit-tests/group-manager.t.cpp b/tests/unit-tests/group-manager.t.cpp
index abf78e7..30bfd6c 100644
--- a/tests/unit-tests/group-manager.t.cpp
+++ b/tests/unit-tests/group-manager.t.cpp
@@ -186,10 +186,10 @@
BOOST_CHECK_EQUAL(nonceContent.type(), tlv::EncryptedContent);
EncryptedContent encryptedNonce(nonceContent);
BOOST_CHECK_EQUAL(encryptedNonce.getInitialVector().size(), 0);
- BOOST_CHECK_EQUAL(encryptedNonce.getAlgorithmType(), tlv::AlgorithmRsaPkcs);
+ BOOST_CHECK_EQUAL(encryptedNonce.getAlgorithmType(), tlv::AlgorithmRsaOaep);
const Buffer& bufferNonce = encryptedNonce.getPayload();
- algo::EncryptParams decryptParams(tlv::AlgorithmRsaPkcs);
+ algo::EncryptParams decryptParams(tlv::AlgorithmRsaOaep);
Buffer nonce = algo::Rsa::decrypt(decryptKeyBuf.buf(), decryptKeyBuf.size(),
bufferNonce.buf(), bufferNonce.size(), decryptParams);
@@ -306,9 +306,9 @@
BOOST_CHECK_EQUAL(nonceContent.type(), tlv::EncryptedContent);
EncryptedContent encryptedNonce(nonceContent);
BOOST_CHECK_EQUAL(encryptedNonce.getInitialVector().size(), 0);
- BOOST_CHECK_EQUAL(encryptedNonce.getAlgorithmType(), tlv::AlgorithmRsaPkcs);
+ BOOST_CHECK_EQUAL(encryptedNonce.getAlgorithmType(), tlv::AlgorithmRsaOaep);
- algo::EncryptParams decryptParams(tlv::AlgorithmRsaPkcs);
+ algo::EncryptParams decryptParams(tlv::AlgorithmRsaOaep);
const Buffer& bufferNonce = encryptedNonce.getPayload();
Buffer nonce = algo::Rsa::decrypt(decryptKeyBuf.buf(), decryptKeyBuf.size(),
bufferNonce.buf(), bufferNonce.size(), decryptParams);