Merge "Add validation to IpSecConfig algorithm setters" am: 53e5d21924 am: c93df5ca1c

am: c135035ab6

Change-Id: I7ff85771945c68025ce8d66ca85313bac087b3a5
This commit is contained in:
Benedict Wong
2018-01-09 21:23:35 +00:00
committed by android-build-merger
2 changed files with 51 additions and 11 deletions

View File

@@ -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()