You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
add KeyGenerator for AndroidKeyStore
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
package android.security.keystore;
|
||||
|
||||
public class KeyGenParameterSpec {
|
||||
|
||||
private String keystoreAlias;
|
||||
private int purposes;
|
||||
private int keySize;
|
||||
private String[] blockModes;
|
||||
private String[] encryptionPaddings;
|
||||
private boolean userAuthenticationRequired;
|
||||
|
||||
public static class Builder {
|
||||
private KeyGenParameterSpec spec = new KeyGenParameterSpec();
|
||||
|
||||
public Builder(String keystoreAlias, int purposes) {
|
||||
spec.keystoreAlias = keystoreAlias;
|
||||
spec.purposes = purposes;
|
||||
}
|
||||
|
||||
public Builder setKeySize(int keySize) {
|
||||
spec.keySize = keySize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setBlockModes(String[] blockModes) {
|
||||
spec.blockModes = blockModes;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setEncryptionPaddings(String[] encryptionPaddings) {
|
||||
spec.encryptionPaddings = encryptionPaddings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUserAuthenticationRequired(boolean userAuthenticationRequired) {
|
||||
spec.userAuthenticationRequired = userAuthenticationRequired;
|
||||
return this;
|
||||
}
|
||||
|
||||
public KeyGenParameterSpec build() {
|
||||
return spec;
|
||||
}
|
||||
}
|
||||
|
||||
public int getKeySize() {
|
||||
return keySize;
|
||||
}
|
||||
|
||||
public String[] getBlockModes() {
|
||||
return blockModes;
|
||||
}
|
||||
|
||||
public int getPurposes() {
|
||||
return purposes;
|
||||
}
|
||||
|
||||
public String[] getEncryptionPaddings() {
|
||||
return encryptionPaddings;
|
||||
}
|
||||
|
||||
public boolean isUserAuthenticationRequired() {
|
||||
return userAuthenticationRequired;
|
||||
}
|
||||
|
||||
public String getKeystoreAlias() {
|
||||
return keystoreAlias;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user