Google is committed to advancing racial equity for Black communities. See how.
Added in API level 28

IpSecAlgorithm

class IpSecAlgorithm : Parcelable
kotlin.Any
   ↳ android.net.IpSecAlgorithm

This class represents a single algorithm that can be used by an IpSecTransform.

Summary

Constants
static String

AES-GCM Authentication/Integrity + Encryption/Ciphering Algorithm.

static String

MD5 HMAC Authentication/Integrity Algorithm.

static String

SHA1 HMAC Authentication/Integrity Algorithm.

static String

SHA256 HMAC Authentication/Integrity Algorithm.

static String

SHA384 HMAC Authentication/Integrity Algorithm.

static String

SHA512 HMAC Authentication/Integrity Algorithm.

static String

AES-CBC Encryption/Ciphering Algorithm.

Inherited constants
Public constructors
<init>(algorithm: String, key: ByteArray)

Creates an IpSecAlgorithm of one of the supported types.

<init>(algorithm: String, key: ByteArray, truncLenBits: Int)

Creates an IpSecAlgorithm of one of the supported types.

Public methods
Int

ByteArray

Get the key for this algorithm

String

Get the algorithm name

Int

Get the truncation length of this algorithm, in bits

String

Returns a string representation of the object.

Unit
writeToParcel(out: Parcel!, flags: Int)

Write to parcel

Properties
static Parcelable.Creator<IpSecAlgorithm!>

Parcelable Creator

Constants

AUTH_CRYPT_AES_GCM

Added in API level 28
static val AUTH_CRYPT_AES_GCM: String

AES-GCM Authentication/Integrity + Encryption/Ciphering Algorithm.

Valid lengths for keying material are {160, 224, 288}.

As per RFC4106 (Section 8.1), keying material consists of a 128, 192, or 256 bit AES key followed by a 32-bit salt. RFC compliance requires that the salt must be unique per invocation with the same key.

Valid ICV (truncation) lengths are {64, 96, 128}.

Value: "rfc4106(gcm(aes))"

AUTH_HMAC_MD5

Added in API level 28
static val AUTH_HMAC_MD5: String

MD5 HMAC Authentication/Integrity Algorithm. This algorithm is not recommended for use in new applications and is provided for legacy compatibility with 3gpp infrastructure.

Keys for this algorithm must be 128 bits in length.

Valid truncation lengths are multiples of 8 bits from 96 to 128.

Value: "hmac(md5)"

AUTH_HMAC_SHA1

Added in API level 28
static val AUTH_HMAC_SHA1: String

SHA1 HMAC Authentication/Integrity Algorithm. This algorithm is not recommended for use in new applications and is provided for legacy compatibility with 3gpp infrastructure.

Keys for this algorithm must be 160 bits in length.

Valid truncation lengths are multiples of 8 bits from 96 to 160.

Value: "hmac(sha1)"

AUTH_HMAC_SHA256

Added in API level 28
static val AUTH_HMAC_SHA256: String

SHA256 HMAC Authentication/Integrity Algorithm.

Keys for this algorithm must be 256 bits in length.

Valid truncation lengths are multiples of 8 bits from 96 to 256.

Value: "hmac(sha256)"

AUTH_HMAC_SHA384

Added in API level 28
static val AUTH_HMAC_SHA384: String

SHA384 HMAC Authentication/Integrity Algorithm.

Keys for this algorithm must be 384 bits in length.

Valid truncation lengths are multiples of 8 bits from 192 to 384.

Value: "hmac(sha384)"

AUTH_HMAC_SHA512

Added in API level 28
static val AUTH_HMAC_SHA512: String

SHA512 HMAC Authentication/Integrity Algorithm.

Keys for this algorithm must be 512 bits in length.

Valid truncation lengths are multiples of 8 bits from 256 to 512.

Value: "hmac(sha512)"

CRYPT_AES_CBC

Added in API level 28
static val CRYPT_AES_CBC: String

AES-CBC Encryption/Ciphering Algorithm.

Valid lengths for this key are {128, 192, 256}.

Value: "cbc(aes)"

Public constructors

<init>

Added in API level 28
IpSecAlgorithm(
    algorithm: String,
    key: ByteArray)

Creates an IpSecAlgorithm of one of the supported types. Supported algorithm names are defined as constants in this class.

For algorithms that produce an integrity check value, the truncation length is a required parameter. See IpSecAlgorithm(java.lang.String,byte[] key,int truncLenBits)

Parameters
algorithm String: name of the algorithm. This value cannot be null. Value is android.net.IpSecAlgorithm#CRYPT_AES_CBC, android.net.IpSecAlgorithm#AUTH_HMAC_MD5, android.net.IpSecAlgorithm#AUTH_HMAC_SHA1, android.net.IpSecAlgorithm#AUTH_HMAC_SHA256, android.net.IpSecAlgorithm#AUTH_HMAC_SHA384, android.net.IpSecAlgorithm#AUTH_HMAC_SHA512, or android.net.IpSecAlgorithm#AUTH_CRYPT_AES_GCM
key ByteArray: key padded to a multiple of 8 bits. This value cannot be null.

<init>

Added in API level 28
IpSecAlgorithm(
    algorithm: String,
    key: ByteArray,
    truncLenBits: Int)

Creates an IpSecAlgorithm of one of the supported types. Supported algorithm names are defined as constants in this class.

This constructor only supports algorithms that use a truncation length. i.e. Authentication and Authenticated Encryption algorithms.

Parameters
algorithm String: name of the algorithm. This value cannot be null. Value is android.net.IpSecAlgorithm#CRYPT_AES_CBC, android.net.IpSecAlgorithm#AUTH_HMAC_MD5, android.net.IpSecAlgorithm#AUTH_HMAC_SHA1, android.net.IpSecAlgorithm#AUTH_HMAC_SHA256, android.net.IpSecAlgorithm#AUTH_HMAC_SHA384, android.net.IpSecAlgorithm#AUTH_HMAC_SHA512, or android.net.IpSecAlgorithm#AUTH_CRYPT_AES_GCM
key ByteArray: key padded to a multiple of 8 bits. This value cannot be null.
truncLenBits Int: number of bits of output hash to use.

Public methods

describeContents

Added in API level 28
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getKey

Added in API level 28
fun getKey(): ByteArray

Get the key for this algorithm

Return
ByteArray This value cannot be null.

getName

Added in API level 28
fun getName(): String

Get the algorithm name

Return
String This value cannot be null.

getTruncationLengthBits

Added in API level 28
fun getTruncationLengthBits(): Int

Get the truncation length of this algorithm, in bits

toString

Added in API level 28
fun toString(): String

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

getClass().getName() + '@' + Integer.toHexString(hashCode())
  
Return
String This value cannot be null.

writeToParcel

Added in API level 28
fun writeToParcel(
    out: Parcel!,
    flags: Int
): Unit

Write to parcel

Parameters
dest The Parcel in which the object should be written.
flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Properties

CREATOR

Added in API level 28
static val CREATOR: Parcelable.Creator<IpSecAlgorithm!>

Parcelable Creator