Since: API level 39
public static abstract class

UcmAgentProviderImpl.UcmAgentKeyAgreementSpi

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

Class Overview

This class provides API's extended from KeyAgreementSpi. If vendor wants to support KeyAgreement as JCE, plugin application should implement this Spi and add as Service Provider.

Since
API level 39
KNOX 3.12

Summary

[Expand]
Inherited Constants
From interface com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentSpiProperty
Public Constructors
UcmAgentKeyAgreementSpi()
Public Methods
abstract Key engineDoPhase(Key key, boolean lastPhase)
Standard KeyAgreement API
abstract byte[] engineGenerateSecret()
Standard KeyAgreement API
abstract SecretKey engineGenerateSecret(String algorithm)
Standard KeyAgreement API
abstract int engineGenerateSecret(byte[] sharedSecret, int offset)
Standard KeyAgreement API
abstract void engineInit(Key key, SecureRandom random)
Standard KeyAgreement API
abstract void engineInit(Key key, AlgorithmParameterSpec params, SecureRandom random)
Standard KeyAgreement 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.
[Expand]
Inherited Methods
From class javax.crypto.KeyAgreementSpi
From class java.lang.Object
From interface com.samsung.android.knox.ucm.plugin.agent.UcmAgentProviderImpl.UcmAgentSpiProperty

Public Constructors

public UcmAgentKeyAgreementSpi ()

Since: API level 39

Public Methods

public abstract Key engineDoPhase (Key key, boolean lastPhase)

Since: API level 39

Standard KeyAgreement API

Since
API level 39
KNOX 3.12

public abstract byte[] engineGenerateSecret ()

Since: API level 39

Standard KeyAgreement API

Since
API level 39
KNOX 3.12

public abstract SecretKey engineGenerateSecret (String algorithm)

Since: API level 39

Standard KeyAgreement API

Since
API level 39
KNOX 3.12

public abstract int engineGenerateSecret (byte[] sharedSecret, int offset)

Since: API level 39

Standard KeyAgreement API

Since
API level 39
KNOX 3.12

public abstract void engineInit (Key key, SecureRandom random)

Since: API level 39

Standard KeyAgreement API

Since
API level 39
KNOX 3.12

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

Since: API level 39

Standard KeyAgreement API

Since
API level 39
KNOX 3.12

public Bundle getProperty ()

Since: API level 39

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

Returns
  • Bundle 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 SimpleUcmAgentKeyGeneratorSpi extends UcmAgentProviderImpl.UcmAgentKeyGeneratorSpi {
   public SimpleUcmAgentKeyGeneratorSpi(Context ctx, String algorithm) {
     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 39
KNOX 3.12
Multiuser Environment
Global Scope

public void setErrorCode (int error)

Since: API level 39

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

 public class SimpleUcmAgentKeyGeneratorSpi extends UcmAgentProviderImpl.UcmAgentKeyGeneratorSpi {
   public void generateKey() {
     ...
     setErrorCode(UcmAgentService.ERROR_EMPTY_PARAMETER);
     ...
   }
 }
 

Parameters
error Error code
Since
API level 39
KNOX 3.12
Multiuser Environment
Global Scope