Package com.esri.arcgisruntime.security
Class CertificateCredential
- java.lang.Object
-
- com.esri.arcgisruntime.security.Credential
-
- com.esri.arcgisruntime.security.CertificateCredential
-
- All Implemented Interfaces:
TokenCredential
public final class CertificateCredential extends Credential implements TokenCredential
Represents a digital certificate used to access certificate secured resources. Supports PKCS#12 cryptography archive bundle files. PKCS#12 is an archive file format for storing multiple cryptography objects. It can contain details about a private key, its certificate, and any associated CA certificates. The archive is usually identified by its .pfx or .p12 file extension. The archive itself or objects it contains may be encrypted and signed.- Since:
- 100.2.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.esri.arcgisruntime.security.Credential
Credential.CredentialChangedEvent, Credential.CredentialChangedListener
-
-
Constructor Summary
Constructors Constructor Description CertificateCredential(String certificatePath, String certificatePassword)
Instantiates a CertificateCredential.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CertificateCredential
copy()
Creates a copy of this CertificateCredential instance.boolean
equals(Object o)
String
getAlias()
Gets the alias associated with the certificate.Certificate[]
getCertificateChain()
Gets the certificate chain associated with the credential.String
getPassword()
Gets the password used to access the certificate file.String
getPath()
Gets the certificatePath that was passed to theCertificateCredential(String, String)
constructor.PrivateKey
getPrivateKey()
Gets the PrivateKey associated with the credential.String
getUsername()
Gets the username of the credential.int
hashCode()
String
toJson()
Writes this Credential object to a json String representation.-
Methods inherited from class com.esri.arcgisruntime.security.Credential
addCredentialChangedListener, fromJson, removeCredentialChangedListener
-
-
-
-
Constructor Detail
-
CertificateCredential
public CertificateCredential(String certificatePath, String certificatePassword)
Instantiates a CertificateCredential.- Parameters:
certificatePath
- the file path to a PKCS#12 file on diskcertificatePassword
- the password to access and decrypt the provided certificate file- Throws:
IllegalArgumentException
- if the certificatePath is null or empty- Since:
- 100.2.0
-
-
Method Detail
-
getAlias
public String getAlias()
Gets the alias associated with the certificate.- Returns:
- the alias associated with the certificate, null if none has been set
- Since:
- 100.2.0
-
getPrivateKey
public PrivateKey getPrivateKey()
Gets the PrivateKey associated with the credential.- Returns:
- the private key
- Since:
- 100.4.0
-
getCertificateChain
public Certificate[] getCertificateChain()
Gets the certificate chain associated with the credential.- Returns:
- the certificate chain
- Since:
- 100.4.0
-
getPath
public String getPath()
Gets the certificatePath that was passed to theCertificateCredential(String, String)
constructor.- Returns:
- the path to the PKCS#12 file
- Since:
- 100.2.0
-
getPassword
public String getPassword()
Gets the password used to access the certificate file.- Returns:
- the password
- Since:
- 100.2.0
-
getUsername
public String getUsername()
Description copied from class:Credential
Gets the username of the credential.- Overrides:
getUsername
in classCredential
- Returns:
- the username
-
copy
public CertificateCredential copy()
Creates a copy of this CertificateCredential instance.- Specified by:
copy
in classCredential
- Returns:
- a copy of this CertificateCredential instance
- Since:
- 100.2.0
-
toJson
public String toJson()
Description copied from class:Credential
Writes this Credential object to a json String representation. This allows for persisting the credential to disk. It is imperative that this String is encrypted before being persisted to disk, or else it may pose a security vulnerability.- Overrides:
toJson
in classCredential
- Returns:
- a json String representation of this Credential
-
-