Added in API level 28

Builder


class Builder
kotlin.Any
   ↳ android.net.IpSecTransform.Builder

This class is used to build IpSecTransform objects.

Summary

Public constructors
Builder(context: Context)

Create a new IpSecTransform.

Public methods
open IpSecTransform

Build a transport mode IpSecTransform.

open IpSecTransform.Builder

Set the authenticated encryption algorithm.

open IpSecTransform.Builder

Set the authentication (integrity) algorithm.

open IpSecTransform.Builder

Set the encryption algorithm.

open IpSecTransform.Builder

Add UDP encapsulation to an IPv4 transform.

Public constructors

Builder

Added in API level 28
Builder(context: Context)

Create a new IpSecTransform.Builder.

Parameters
context Context: current context This value cannot be null.

Public methods

buildTransportModeTransform

Added in API level 28
open fun buildTransportModeTransform(
    sourceAddress: InetAddress,
    spi: IpSecManager.SecurityParameterIndex
): IpSecTransform

Build a transport mode IpSecTransform.

This builds and activates a transport mode transform. Note that an active transform will not affect any network traffic until it has been applied to one or more sockets.

Parameters
sourceAddress InetAddress: the source InetAddress of traffic on sockets that will use this transform; this address must belong to the Network used by all sockets that utilize this transform; if provided, then only traffic originating from the specified source address will be processed. This value cannot be null.
spi IpSecManager.SecurityParameterIndex: a unique IpSecManager.SecurityParameterIndex to identify transformed traffic This value cannot be null.
Return
IpSecTransform This value cannot be null.
Exceptions
java.lang.IllegalArgumentException indicating that a particular combination of transform properties is invalid
android.net.IpSecManager.ResourceUnavailableException indicating that too many transforms are active
android.net.IpSecManager.SpiUnavailableException indicating the rare case where an SPI collides with an existing transform
java.io.IOException indicating other errors

See Also

    setAuthenticatedEncryption

    Added in API level 28
    open fun setAuthenticatedEncryption(algo: IpSecAlgorithm): IpSecTransform.Builder

    Set the authenticated encryption algorithm.

    The Authenticated Encryption (AE) class of algorithms are also known as Authenticated Encryption with Associated Data (AEAD) algorithms, or Combined mode algorithms (as referred to in RFC 4301).

    Authenticated encryption is mutually exclusive with encryption and authentication.

    Parameters
    algo IpSecAlgorithm: IpSecAlgorithm specifying the authenticated encryption algorithm to be applied. This value cannot be null.
    Return
    IpSecTransform.Builder This value cannot be null.

    setAuthentication

    Added in API level 28
    open fun setAuthentication(algo: IpSecAlgorithm): IpSecTransform.Builder

    Set the authentication (integrity) algorithm.

    Authentication is mutually exclusive with authenticated encryption.

    Parameters
    algo IpSecAlgorithm: IpSecAlgorithm specifying the authentication to be applied. This value cannot be null.
    Return
    IpSecTransform.Builder This value cannot be null.

    setEncryption

    Added in API level 28
    open fun setEncryption(algo: IpSecAlgorithm): IpSecTransform.Builder

    Set the encryption algorithm.

    Encryption is mutually exclusive with authenticated encryption.

    Parameters
    algo IpSecAlgorithm: IpSecAlgorithm specifying the encryption to be applied. This value cannot be null.
    Return
    IpSecTransform.Builder This value cannot be null.

    setIpv4Encapsulation

    Added in API level 28
    open fun setIpv4Encapsulation(
        localSocket: IpSecManager.UdpEncapsulationSocket,
        remotePort: Int
    ): IpSecTransform.Builder

    Add UDP encapsulation to an IPv4 transform.

    This allows IPsec traffic to pass through a NAT.

    Parameters
    localSocket IpSecManager.UdpEncapsulationSocket: a socket for sending and receiving encapsulated traffic This value cannot be null.
    remotePort Int: the UDP port number of the remote host that will send and receive encapsulated traffic. In the case of IKEv2, this should be port 4500.
    Return
    IpSecTransform.Builder This value cannot be null.

    See Also