[GEARAMA]: Final set of updates from archboard review of KeyVault certificates (#3050)

* investigateTestFail

* undo stuffs

* couple more comments

* key_usage fix

* put back stuff

* remove name

* bb

* undo stuffs

* couple more comments

* key_usage fix

* put back stuff

* remove name

* bb

* bbfix

* merge issues
This commit is contained in:
George Arama 2021-11-04 17:54:28 -07:00 committed by GitHub
parent e498d6a165
commit 34fe4dcfb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 8 deletions

View File

@ -1437,7 +1437,7 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
* needs to contain the private key.
*
*/
std::string Value;
std::string Certificate;
/**
* @brief If the private key in base64EncodedCertificate is encrypted, the password used for

View File

@ -48,7 +48,7 @@ int main()
{
// prepare the parameters
ImportCertificateOptions options;
options.Value = GetPemCertificate();
options.Certificate = GetPemCertificate();
options.Policy.Enabled = true;
options.Policy.KeyType = CertificateKeyType::Rsa;
@ -65,7 +65,7 @@ int main()
{
// prepare the parameters
ImportCertificateOptions options;
options.Value = GetPkcsCertificate();
options.Certificate = GetPkcsCertificate();
options.Policy.Enabled = true;
options.Policy.KeyType = CertificateKeyType::Rsa;

View File

@ -195,7 +195,7 @@ void CertificatePolicySerializer::Deserialize(
JsonOptional::SetIfExists<std::vector<std::string>, std::vector<CertificateKeyUsage>>(
policy.KeyUsage,
x509PropsJson,
UserPrincipalNamesPropertyName,
KeyUsagePropertyName,
[](std::vector<std::string> const& values) {
std::vector<CertificateKeyUsage> keyUsage;
for (auto const& item : values)
@ -784,7 +784,7 @@ std::string ImportCertificateOptionsSerializer::Serialize(ImportCertificateOptio
{
json importOptions;
importOptions[ValuePropertyName] = options.Value;
importOptions[ValuePropertyName] = options.Certificate;
JsonOptional::SetFromNullable(options.Password, importOptions, PwdPropertyValue);
importOptions[PolicyPropertyName] = CertificatePolicySerializer::JsonSerialize(options.Policy);
importOptions[AttributesPropertyName]

View File

@ -276,7 +276,13 @@ namespace Azure {
EXPECT_EQ(
result.Value.Policy.LifetimeActions[0].LifetimePercentage.Value(),
action.LifetimePercentage.Value());
EXPECT_EQ(result.Value.Policy.KeyUsage.size(), size_t(2));
auto keyUsage = result.Value.Policy.KeyUsage;
EXPECT_TRUE(
(keyUsage[0] == CertificateKeyUsage::DigitalSignature
&& keyUsage[1] == CertificateKeyUsage::KeyEncipherment)
|| (keyUsage[1] == CertificateKeyUsage::DigitalSignature
&& keyUsage[0] == CertificateKeyUsage::KeyEncipherment));
return result.Value;
}

View File

@ -755,7 +755,7 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPkcs)
{
auto result = DownloadCertificate(pkcs, client);
ImportCertificateOptions options;
options.Value = result.Value.Certificate;
options.Certificate = result.Value.Certificate;
options.Policy.Enabled = true;
options.Policy.KeyType = CertificateKeyType::Rsa;
@ -788,7 +788,7 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPem)
{
auto result = DownloadCertificate(pem, client);
ImportCertificateOptions options;
options.Value = result.Value.Certificate;
options.Certificate = result.Value.Certificate;
options.Policy.Enabled = true;
options.Policy.KeyType = CertificateKeyType::Rsa;