public static abstract class

UcmAgentProviderImpl.UcmAgentCipherSpi

extends CipherSpi
implements UcmAgentProviderImpl.UcmAgentSpiProperty
java.lang.Object
   ↳ javax.crypto.CipherSpi
     ↳ com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentCipherSpi

Class Overview

This class provide API's extended from CipherSpi. If vendor want to support Cipher as JCE, plugin application should implement this Spi and add as Service Provider.

Since
API level 20
KNOX 2.7

Summary

[Expand]
Inherited Constants
From interface com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentSpiProperty
Public Constructors
UcmAgentCipherSpi()
Public Methods
abstract byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
Standard Cipher API.
abstract void engineInit(int opmode, Key key, SecureRandom random)
Standard Cipher API.
abstract void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)
Standard Cipher API.
abstract void engineUpdateAAD(byte[] src, int offset, int len)
Standard Cipher API.
Bundle getProperty()
API to get the properties set by UCM framework during SPI call.
void setErrorCode(int error)
API to set the error code(if any) which will be forwarded to calling application via UCM framework.
Protected Methods
int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
Standard Cipher API.
int engineGetBlockSize()
Standard Cipher API.
byte[] engineGetIV()
Standard Cipher API.
int engineGetOutputSize(int inputLen)
Standard Cipher API.
AlgorithmParameters engineGetParameters()
Standard Cipher API.
void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)
Standard Cipher API.
byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)
Standard Cipher API.
int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)
Standard Cipher API.
[Expand]
Inherited Methods
From class javax.crypto.CipherSpi
From class java.lang.Object
From interface com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentSpiProperty

Public Constructors

public UcmAgentCipherSpi ()

Since: API level 20

Public Methods

public abstract byte[] engineDoFinal (byte[] input, int inputOffset, int inputLen)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

public abstract void engineInit (int opmode, Key key, SecureRandom random)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

public abstract void engineInit (int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

public abstract void engineUpdateAAD (byte[] src, int offset, int len)

Since: API level 37

Standard Cipher API.

Since
API level 37
KNOX 3.10

public Bundle getProperty ()

Since: API level 20

API to get the properties set by UCM framework during SPI call.

Returns
  • Bundle calling application information
Usage

To perform crypto operation properly, plugin application should know caller information. Plugin application can use this API to get caller user Id, resource Id, caller application Uid and owner Id

 public class SimpleUcmAgentCipherSpi extends UcmAgentProviderImpl.UcmAgentCipherSpi {
   public SimpleUcmAgentCipherSpi(Context ctx,..) {
     Bundle bundle = getProperty();
     int userId = bundle.getInt(UcmAgentSpiProperty.KEY_USER_ID, -1));
     int resourceId = bundle.getInt(UcmAgentSpiProperty.KEY_RESOURCE_ID , -1));
     int callerId = bundle.getInt(UcmAgentSpiProperty.KEY_CALLER_UID , -1));
   }
 }
 
Since
API level 20
KNOX 2.7
Multiuser Environment
Global Scope

public void setErrorCode (int error)

Since: API level 20

API to set the error code(if any) which will be forwarded to calling application via UCM framework.

 public class SimpleUcmAgentCipherSpi extends UcmAgentProviderImpl.UcmAgentCipherSpi {
   public void engineInit(int opmode, Key key, SecureRandom secureRandom) {
     ...
     setErrorCode(UcmAgentService.ERROR_EMPTY_PARAMETER);
     ...
   }
 }
 

Parameters
error Error code
Since
API level 20
KNOX 2.7
Multiuser Environment
Global Scope

Protected Methods

protected int engineDoFinal (byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected int engineGetBlockSize ()

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected byte[] engineGetIV ()

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected int engineGetOutputSize (int inputLen)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected AlgorithmParameters engineGetParameters ()

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected void engineInit (int opmode, Key key, AlgorithmParameters params, SecureRandom random)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected byte[] engineUpdate (byte[] input, int inputOffset, int inputLen)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7

protected int engineUpdate (byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset)

Since: API level 20

Standard Cipher API.

Since
API level 20
KNOX 2.7