summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorBenedict Wong <benedictwong@google.com>2018-01-09 18:31:14 +0000
committerandroid-build-merger <android-build-merger@google.com>2018-01-09 18:31:14 +0000
commitc93df5ca1c974960f1694647d28b157b512d9ceb (patch)
treecbbd8fed262a2957185b8e857c458c66e2415db9 /core/java
parentd14b30205cd7b980cece26a80692b2970ea11542 (diff)
parenta954f20f468fd9f9a6a8a45f3f49dbab3df75e30 (diff)
Merge "Add validation to IpSecConfig algorithm setters"
am: a954f20f46 Change-Id: I7d241a4348fd1339ff7475ee9301c7fe6c7453c0
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/net/IpSecAlgorithm.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/core/java/android/net/IpSecAlgorithm.java b/core/java/android/net/IpSecAlgorithm.java
index f82627b942c3..7d752e89e6f6 100644
--- a/core/java/android/net/IpSecAlgorithm.java
+++ b/core/java/android/net/IpSecAlgorithm.java
@@ -231,6 +231,31 @@ public final class IpSecAlgorithm implements Parcelable {
}
}
+ /** @hide */
+ public boolean isAuthentication() {
+ switch (getName()) {
+ // Fallthrough
+ case AUTH_HMAC_MD5:
+ case AUTH_HMAC_SHA1:
+ case AUTH_HMAC_SHA256:
+ case AUTH_HMAC_SHA384:
+ case AUTH_HMAC_SHA512:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ /** @hide */
+ public boolean isEncryption() {
+ return getName().equals(CRYPT_AES_CBC);
+ }
+
+ /** @hide */
+ public boolean isAead() {
+ return getName().equals(AUTH_CRYPT_AES_GCM);
+ }
+
@Override
public String toString() {
return new StringBuilder()