Class DeviceIdentifier


  • public class DeviceIdentifier
    extends java.lang.Object
    Model of Device Identifier
    • Constructor Summary

      Constructors 
      Constructor Description
      DeviceIdentifier​(android.content.Context context, org.forgerock.android.auth.KeyStoreManager keyStoreManager)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static DeviceIdentifier.DeviceIdentifierBuilder builder()  
      java.security.cert.Certificate getCertificate()
      Retrieve the certificate that used to generate the device ID.
      java.lang.String getIdentifier()
      Retrieve the Device Identifier, the device identifier is stable except when:
      void persist​(byte[] certificate)
      Persist the X509 certificate to the KeyStore, the certificate will be used to generate the Device Key Identifier
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DeviceIdentifier

        public DeviceIdentifier​(@NotNull
                                android.content.Context context,
                                org.forgerock.android.auth.KeyStoreManager keyStoreManager)
        Parameters:
        context -
        keyStoreManager -
    • Method Detail

      • getIdentifier

        public java.lang.String getIdentifier()
        Retrieve the Device Identifier, the device identifier is stable except when:

        * App is restored on a new device

        * User uninstalls/reinstall the App

        * User clears app data.

        Returns:
        The Device Identifier.
      • getCertificate

        @Nullable
        public java.security.cert.Certificate getCertificate()
                                                      throws java.security.GeneralSecurityException,
                                                             java.io.IOException
        Retrieve the certificate that used to generate the device ID. The Certificate is stored in the Android KeyStore
        Returns:
        the certificate, or null if the given alias does not exist or does not contain a certificate.
        Throws:
        java.security.GeneralSecurityException - General Security Exception when access the KeyStore
        java.io.IOException - IOException when access the KeyStore
      • persist

        public void persist​(byte[] certificate)
                     throws java.security.GeneralSecurityException,
                            java.io.IOException
        Persist the X509 certificate to the KeyStore, the certificate will be used to generate the Device Key Identifier
        Parameters:
        certificate - the certificate that used to generate the device identifier.
        Throws:
        java.security.GeneralSecurityException - General Security Exception when access the KeyStore
        java.io.IOException - IOException when access the KeyStore