我正在构建一个基于移动中心示例应用程序的应用程序。示例应用程序将 API 密钥存储在类文件 AWSconfiguration 中:
public class AWSConfiguration {
// AWS MobileHub user agent string
public static final String AWS_MOBILEHUB_USER_AGENT =
"MobileHub ********* aws-my-sample-app-android-v0.16";
// AMAZON COGNITO
public static final Regions AMAZON_COGNITO_REGION =
Regions.fromName("us-east-1");
public static String AMAZON_COGNITO_IDENTITY_POOL_ID = "us-east-************6";
// Google Client ID for Web application
public static String GOOGLE_CLIENT_ID ="";//"*********************.apps.googleusercontent.com";
public static final Regions AMAZON_DYNAMODB_REGION =
Regions.fromName("us-east-1");
public static String AMAZON_COGNITO_USER_POOL_ID = "************";
public static String AMAZON_COGNITO_USER_POOL_CLIENT_ID = "*************";
public static String AMAZON_COGNITO_USER_POOL_CLIENT_SECRET = "*************";
private static final AWSMobileHelperConfiguration helperConfiguration = new AWSMobileHelperConfiguration.Builder()
.withCognitoRegion(AMAZON_COGNITO_REGION)
.withCognitoIdentityPoolId(AMAZON_COGNITO_IDENTITY_POOL_ID)
.withCognitoUserPool(AMAZON_COGNITO_USER_POOL_ID,
AMAZON_COGNITO_USER_POOL_CLIENT_ID, AMAZON_COGNITO_USER_POOL_CLIENT_SECRET)
.build();
/**
* @return the configuration for AWSKit.
*/
public static AWSMobileHelperConfiguration getAWSMobileHelperConfiguration() {
return helperConfiguration;
}
}
以这种方式存储客户端密钥似乎不安全。有哪些风险?
我尝试将密钥隐藏在 JNI 文件中,但在从移动助手调用密钥之前无法在活动中找到正确的入口点来设置密钥。