IpSecAlgorithm
public
final
class
IpSecAlgorithm
extends Object
implements
Parcelable
java.lang.Object  
↳  android.net.IpSecAlgorithm 
This class represents a single algorithm that can be used by an IpSecTransform
.
Summary
Constants  

String 
AUTH_CRYPT_AES_GCM
AESGCM Authentication/Integrity + Encryption/Ciphering Algorithm. 
String 
AUTH_HMAC_MD5
MD5 HMAC Authentication/Integrity Algorithm. 
String 
AUTH_HMAC_SHA1
SHA1 HMAC Authentication/Integrity Algorithm. 
String 
AUTH_HMAC_SHA256
SHA256 HMAC Authentication/Integrity Algorithm. 
String 
AUTH_HMAC_SHA384
SHA384 HMAC Authentication/Integrity Algorithm. 
String 
AUTH_HMAC_SHA512
SHA512 HMAC Authentication/Integrity Algorithm. 
String 
CRYPT_AES_CBC
AESCBC Encryption/Ciphering Algorithm. 
Inherited constants 

Fields  

public
static
final
Creator<IpSecAlgorithm> 
CREATOR
Parcelable Creator 
Public constructors  

IpSecAlgorithm(String algorithm, byte[] key)
Creates an IpSecAlgorithm of one of the supported types. 

IpSecAlgorithm(String algorithm, byte[] key, int truncLenBits)
Creates an IpSecAlgorithm of one of the supported types. 
Public methods  

int

describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. 
byte[]

getKey()
Get the key for this algorithm 
String

getName()
Get the algorithm name 
int

getTruncationLengthBits()
Get the truncation length of this algorithm, in bits 
String

toString()
Returns a string representation of the object. 
void

writeToParcel(Parcel out, int flags)
Write to parcel 
Inherited methods  

Constants
AUTH_CRYPT_AES_GCM
String AUTH_CRYPT_AES_GCM
AESGCM 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 32bit salt. RFC compliance requires that the salt must be unique per invocation with the same key.
Valid ICV (truncation) lengths are {64, 96, 128}.
Constant Value: "rfc4106(gcm(aes))"
AUTH_HMAC_MD5
String AUTH_HMAC_MD5
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.
Constant Value: "hmac(md5)"
AUTH_HMAC_SHA1
String AUTH_HMAC_SHA1
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.
Constant Value: "hmac(sha1)"
AUTH_HMAC_SHA256
String AUTH_HMAC_SHA256
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.
Constant Value: "hmac(sha256)"
AUTH_HMAC_SHA384
String AUTH_HMAC_SHA384
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.
Constant Value: "hmac(sha384)"
AUTH_HMAC_SHA512
String AUTH_HMAC_SHA512
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.
Constant Value: "hmac(sha512)"
CRYPT_AES_CBC
String CRYPT_AES_CBC
AESCBC Encryption/Ciphering Algorithm.
Valid lengths for this key are {128, 192, 256}.
Constant Value: "cbc(aes)"
Fields
Public constructors
IpSecAlgorithm
IpSecAlgorithm (String algorithm, byte[] key)
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, byte[], int)
Parameters  

algorithm 
String : name of the algorithm.This value must never be 
key 
byte : key padded to a multiple of 8 bits.
This value must never be 
IpSecAlgorithm
IpSecAlgorithm (String algorithm, byte[] key, int truncLenBits)
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 
key 
byte : key padded to a multiple of 8 bits.This value must never be 
truncLenBits 
int : number of bits of output hash to use.

Public methods
describeContents
int describeContents ()
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.
Returns  

int 
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. 
getKey
byte[] getKey ()
Get the key for this algorithm
Returns  

byte[] 
This value will never be 
getTruncationLengthBits
int getTruncationLengthBits ()
Get the truncation length of this algorithm, in bits
Returns  

int 
toString
String toString ()
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 atsign 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())
Returns  

String 
a string representation of the object.
This value will never be 
writeToParcel
void writeToParcel (Parcel out, int flags)
Write to parcel
Parameters  

out 
Parcel : 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 .
