- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
45 lines
1.5 KiB
Java
45 lines
1.5 KiB
Java
package com.amazonaws.auth;
|
|
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.util.Properties;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class PropertiesCredentials implements AWSCredentials {
|
|
public final String accessKey;
|
|
public final String secretAccessKey;
|
|
|
|
@Override // com.amazonaws.auth.AWSCredentials
|
|
public String getAWSAccessKeyId() {
|
|
return this.accessKey;
|
|
}
|
|
|
|
@Override // com.amazonaws.auth.AWSCredentials
|
|
public String getAWSSecretKey() {
|
|
return this.secretAccessKey;
|
|
}
|
|
|
|
public PropertiesCredentials(File file) {
|
|
if (!file.exists()) {
|
|
throw new FileNotFoundException("File doesn't exist: " + file.getAbsolutePath());
|
|
}
|
|
FileInputStream fileInputStream = new FileInputStream(file);
|
|
try {
|
|
Properties properties = new Properties();
|
|
properties.load(fileInputStream);
|
|
if (properties.getProperty("accessKey") == null || properties.getProperty("secretKey") == null) {
|
|
throw new IllegalArgumentException("The specified file (" + file.getAbsolutePath() + ") doesn't contain the expected properties 'accessKey' and 'secretKey'.");
|
|
}
|
|
this.accessKey = properties.getProperty("accessKey");
|
|
this.secretAccessKey = properties.getProperty("secretKey");
|
|
} finally {
|
|
try {
|
|
fileInputStream.close();
|
|
} catch (IOException unused) {
|
|
}
|
|
}
|
|
}
|
|
}
|