public void GetPrivateKeyTest() { string privatKey = AuthUtils.GetPrivateKey(TestHelper.GetIniFilePath()); Assert.NotNull(privatKey); Assert.NotEmpty(privatKey); }
public IAlibabaCloudCredentials GetSTSGetSessionAccessKeyCredentials(Dictionary <string, string> clientConfig) { string publicKeyId = DictionaryUtil.Get(clientConfig, AuthConstant.IniPublicKeyId); string privateKeyFile = DictionaryUtil.Get(clientConfig, AuthConstant.IniPrivateKeyFile); if (string.IsNullOrWhiteSpace(privateKeyFile)) { throw new CredentialException("The configured private_key_file is empty"); } string privateKey = AuthUtils.GetPrivateKey(privateKeyFile); if (string.IsNullOrWhiteSpace(publicKeyId) || string.IsNullOrWhiteSpace(privateKey)) { throw new CredentialException("The configured public_key_id or private_key_file content is empty"); } RsaKeyPairCredentialProvider provider = new RsaKeyPairCredentialProvider(publicKeyId, privateKey); return(provider.GetCredentials()); }