我需要在Android应用中连接到亚马逊的SimpleDB。亚马逊Android SDK提供的示例项目将凭据放在名为AwsCredentials.properties的文件中,该文件位于项目源中。然后源代码使这些调用访问并使用它们:
Properties properties = new Properties();
properties.load( getClass().getResourceAsStream( "AwsCredentials.properties" ) );
String accessKeyId = properties.getProperty( "accessKey" );
String secretKey = properties.getProperty( "secretKey" );
...
credentials = new BasicAWSCredentials( properties.getProperty( "accessKey" ), properties.getProperty( "secretKey" ) );
这是正确而安全的方法吗?
答案 0 :(得分:3)
我不这样做。它适合快速组合在一起但将AWS凭证存储在属性文件中并不是安全的方法。亚马逊实际上在how to access AWS securely from a mobile device上提供了有用的报道。我还建议查看KeyStore provided by Android。
我在回答您的其他问题时已经写了更多有关using IAM users for mobile AWS credentials的详细信息。