public static abstract class

UcmAgentProviderImpl.UcmAgentSecureRandomSpi

extends SecureRandomSpi
implements UcmAgentProviderImpl.UcmAgentSpiProperty
java.lang.Object
   ↳ java.security.SecureRandomSpi
     ↳ com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentSecureRandomSpi

Class Overview

This class provide API's extended from SecureRandomSpi. If vendor want to support SecureRandomSpi 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
UcmAgentSecureRandomSpi()
Public Methods
abstract byte[] engineGenerateSeed(int numBytes)
Standard SecureRandom 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
void engineMixSeed(byte[] data)
Standard SecureRandom API.
void engineNextBytes(byte[] bytes)
Standard SecureRandom API.
void engineSetSeed(byte[] seed)
Standard SecureRandom API.
[Expand]
Inherited Methods
From class java.security.SecureRandomSpi
From class java.lang.Object
From interface com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentSpiProperty

Public Constructors

public UcmAgentSecureRandomSpi ()

Since: API level 20

Public Methods

public abstract byte[] engineGenerateSeed (int numBytes)

Since: API level 20

Standard SecureRandom API.

Since
API level 20
KNOX 2.7

public Bundle getProperty ()

Since: API level 20

API to get the properties set by UCM framework during SPI call. If vendor want to support SecureRandom as JCE, plugin application should implement this Spi and add as Service Provider.

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 SimpleUcmAgentSecureRandomSpi extends UcmAgentProviderImpl.UcmAgentSecureRandomSpi {
   public SimpleUcmAgentSecureRandomSpi (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 SimpleUcmAgentSecureRandomSpi extends UcmAgentProviderImpl.UcmAgentSecureRandomSpi {
   public void engineSetSeed(int numBytes) {
     ...
     setErrorCode(UcmAgentService.ERROR_EMPTY_PARAMETER);
     ...
   }
 }
 

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

Protected Methods

protected void engineMixSeed (byte[] data)

Since: API level 20

Standard SecureRandom API.

Since
API level 20
KNOX 2.7

protected void engineNextBytes (byte[] bytes)

Since: API level 20

Standard SecureRandom API.

Since
API level 20
KNOX 2.7

protected void engineSetSeed (byte[] seed)

Since: API level 20

Standard SecureRandom API.

Since
API level 20
KNOX 2.7