summaryrefslogtreecommitdiffstats
path: root/keystore/java/android/security/EcIesParameterSpec.java
diff options
context:
space:
mode:
Diffstat (limited to 'keystore/java/android/security/EcIesParameterSpec.java')
-rw-r--r--keystore/java/android/security/EcIesParameterSpec.java23
1 files changed, 19 insertions, 4 deletions
diff --git a/keystore/java/android/security/EcIesParameterSpec.java b/keystore/java/android/security/EcIesParameterSpec.java
index 7af17ed..360270e 100644
--- a/keystore/java/android/security/EcIesParameterSpec.java
+++ b/keystore/java/android/security/EcIesParameterSpec.java
@@ -1,6 +1,8 @@
package android.security;
import android.annotation.IntDef;
+import android.annotation.NonNull;
+import android.annotation.Nullable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -53,7 +55,11 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
* @hide
*/
@Retention(RetentionPolicy.SOURCE)
- @IntDef(value = {PointFormat.UNCOMPRESSED, PointFormat.COMPRESSED})
+ @IntDef({
+ PointFormat.UNSPECIFIED,
+ PointFormat.UNCOMPRESSED,
+ PointFormat.COMPRESSED,
+ })
public @interface PointFormatEnum {}
/**
@@ -130,6 +136,7 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
* Returns KEM KDF algorithm (e.g., {@code HKDFwithSHA256} or {@code KDF1withSHA1}) or
* {@code null} if not specified.
*/
+ @Nullable
public String getKemKdfAlgorithm() {
return mKemKdfAlgorithm;
}
@@ -141,6 +148,7 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
* @see Cipher#getInstance(String)
* @see #getDemCipherKeySize()
*/
+ @Nullable
public String getDemCipherTransformation() {
return mDemCipherTransformation;
}
@@ -161,6 +169,7 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
* @see Mac#getInstance(String)
* @see #getDemMacKeySize()
*/
+ @Nullable
public String getDemMacAlgorithm() {
return mDemMacAlgorithm;
}
@@ -197,7 +206,8 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
* Sets KEM KDF algorithm. For example, {@code HKDFwithSHA256}, {@code KDF2withSHA256}, or
* {@code KDF1withSHA1}.
*/
- public Builder setKemKdfAlgorithm(String algorithm) {
+ @NonNull
+ public Builder setKemKdfAlgorithm(@Nullable String algorithm) {
mKemKdfAlgorithm = algorithm;
return this;
}
@@ -208,7 +218,8 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
*
* @see Cipher#getInstance(String)
*/
- public Builder setDemCipherTransformation(String transformation) {
+ @NonNull
+ public Builder setDemCipherTransformation(@Nullable String transformation) {
mDemCipherTransformation = transformation;
return this;
}
@@ -220,6 +231,7 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
*
* @see #setDemCipherTransformation(String)
*/
+ @NonNull
public Builder setDemCipherKeySize(int sizeBits) {
mDemCipherKeySize = sizeBits;
return this;
@@ -230,7 +242,8 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
*
* @see Mac#getInstance(String)
*/
- public Builder setDemMacAlgorithm(String algorithm) {
+ @NonNull
+ public Builder setDemMacAlgorithm(@Nullable String algorithm) {
mDemMacAlgorithm = algorithm;
return this;
}
@@ -242,6 +255,7 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
*
* @see #setDemCipherKeySize(int)
*/
+ @NonNull
public Builder setDemMacKeySize(int sizeBits) {
mDemMacKeySize = sizeBits;
return this;
@@ -250,6 +264,7 @@ public class EcIesParameterSpec implements AlgorithmParameterSpec {
/**
* Returns a new {@link EcIesParameterSpec} based on the current state of this builder.
*/
+ @NonNull
public EcIesParameterSpec build() {
int demMacKeySize = (mDemMacKeySize != -1) ? mDemMacKeySize : mDemCipherKeySize;
return new EcIesParameterSpec(