IpSecAlgorithm

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

This class represents a single algorithm that can be used by an IpSecTransform.
Requires API level 28 (Android 8.+, P)

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
Unit
writeToParcel(out: Parcel!, flags: Int)

Write to parcel
Requires API level 28 (Android 8.+, P)

Int

Get the truncation length of this algorithm, in bits
Requires API level 28 (Android 8.+, P)

String

Get the algorithm name
Requires API level 28 (Android 8.+, P)

ByteArray

Get the key for this algorithm
Requires API level 28 (Android 8.+, P)

String

Returns a string representation of the object.

Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

Properties
static Parcelable.Creator<IpSecAlgorithm!>!

Parcelable Creator
Requires API level 28 (Android 8.+, P)

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}.
Requires API level 28 (Android 8.+, P)

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.
Requires API level 28 (Android 8.+, P)

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.
Requires API level 28 (Android 8.+, P)

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.
Requires API level 28 (Android 8.+, P)

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.
Requires API level 28 (Android 8.+, P)

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.
Requires API level 28 (Android 8.+, P)

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}.
Requires API level 28 (Android 8.+, P)

Value: "cbc(aes)"

Public constructors

<init>

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(String algorithm, byte[] key, int truncLenBits)

Parameters
algorithm String: name of the algorithm. This value must never 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 String: key padded to a multiple of 8 bits. This value must never be null.

<init>

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 must never 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 String: key padded to a multiple of 8 bits. This value must never be null.
truncLenBits String: number of bits of output hash to use.

Public methods

writeToParcel

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

Write to parcel
Requires API level 28 (Android 8.+, P)

Parameters
dest Parcel!: The Parcel in which the object should be written.
flags Parcel!: 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

getTruncationLengthBits

added in API level 28
fun getTruncationLengthBits(): Int

Get the truncation length of this algorithm, in bits
Requires API level 28 (Android 8.+, P)

getName

added in API level 28
fun getName(): String

Get the algorithm name
Requires API level 28 (Android 8.+, P)

Return
String: This value will never be null.

getKey

added in API level 28
fun getKey(): ByteArray

Get the key for this algorithm
Requires API level 28 (Android 8.+, P)

Return
ByteArray: This value will never be null.

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

Requires API level 28 (Android 8.+, P)
Return
String: This value will never be null.

describeContents

added in API level 28
fun describeContents(): Int

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of #writeToParcel(Parcel, int), the return value of this method must include the #CONTENTS_FILE_DESCRIPTOR bit. Requires API level 28 (Android 8.+, P)

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

Properties

CREATOR

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

Parcelable Creator
Requires API level 28 (Android 8.+, P)