Stay organized with collections
Save and categorize content based on your preferences.
X500PrivateCredential
class X500PrivateCredential : Destroyable
This class represents an X500PrivateCredential
. It associates an X.509 certificate, corresponding private key and the KeyStore alias used to reference that exact key pair in the KeyStore. This enables looking up the private credentials for an X.500 principal in a subject.
Summary
Public constructors |
Creates an X500PrivateCredential that associates an X.
|
Creates an X500PrivateCredential that associates an X.
|
Public constructors
X500PrivateCredential
X500PrivateCredential(
cert: X509Certificate!,
key: PrivateKey!)
Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.
Exceptions |
java.lang.IllegalArgumentException |
if either cert or key is null |
X500PrivateCredential
X500PrivateCredential(
cert: X509Certificate!,
key: PrivateKey!,
alias: String!)
Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.
Exceptions |
java.lang.IllegalArgumentException |
if either cert , key or alias is null |
Public methods
destroy
fun destroy(): Unit
Clears the references to the X.509 certificate, private key and the KeyStore alias in this object.
getAlias
fun getAlias(): String!
Returns the KeyStore alias.
Return |
String! |
the KeyStore alias |
getCertificate
fun getCertificate(): X509Certificate!
Returns the X.509 certificate.
getPrivateKey
fun getPrivateKey(): PrivateKey!
Returns the PrivateKey.
isDestroyed
fun isDestroyed(): Boolean
Determines if the references to the X.509 certificate and private key in this object have been cleared.
Return |
Boolean |
true if X509Certificate and the PrivateKey are null |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# X500PrivateCredential\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nX500PrivateCredential\n=====================\n\n```\nclass X500PrivateCredential : Destroyable\n```\n\n|---|-----------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [javax.security.auth.x500.X500PrivateCredential](#) |\n\nThis class represents an `X500PrivateCredential`. It associates an X.509 certificate, corresponding private key and the KeyStore alias used to reference that exact key pair in the KeyStore. This enables looking up the private credentials for an X.500 principal in a subject.\n\nSummary\n-------\n\n| Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [X500PrivateCredential](#X500PrivateCredential(java.security.cert.X509Certificate,%20java.security.PrivateKey))`(`cert:` `[X509Certificate](../../../../java/security/cert/X509Certificate.html#)!`, `key:` `[PrivateKey](../../../../java/security/PrivateKey.html#)!`)` Creates an X500PrivateCredential that associates an X. |\n| [X500PrivateCredential](#X500PrivateCredential(java.security.cert.X509Certificate,%20java.security.PrivateKey,%20kotlin.String))`(`cert:` `[X509Certificate](../../../../java/security/cert/X509Certificate.html#)!`, `key:` `[PrivateKey](../../../../java/security/PrivateKey.html#)!`, `alias:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Creates an X500PrivateCredential that associates an X. |\n\n| Public methods ||\n|------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [destroy](#destroy())`()` Clears the references to the X. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getAlias](#getAlias())`()` Returns the KeyStore alias. |\n| [X509Certificate](../../../../java/security/cert/X509Certificate.html#)! | [getCertificate](#getCertificate())`()` Returns the X. |\n| [PrivateKey](../../../../java/security/PrivateKey.html#)! | [getPrivateKey](#getPrivateKey())`()` Returns the PrivateKey. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isDestroyed](#isDestroyed())`()` Determines if the references to the X. |\n\nPublic constructors\n-------------------\n\n### X500PrivateCredential\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nX500PrivateCredential(\n cert: X509Certificate!, \n key: PrivateKey!)\n```\n\nCreates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.\n\n| Parameters ||\n|--------|-------------------------------------------------------------------------------------------|\n| `cert` | [X509Certificate](../../../../java/security/cert/X509Certificate.html#)!: X509Certificate |\n| `key` | [PrivateKey](../../../../java/security/PrivateKey.html#)!: PrivateKey for the certificate |\n\n| Exceptions ||\n|--------------------------------------|-----------------------------------|\n| `java.lang.IllegalArgumentException` | if either `cert` or `key` is null |\n\n### X500PrivateCredential\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nX500PrivateCredential(\n cert: X509Certificate!, \n key: PrivateKey!, \n alias: String!)\n```\n\nCreates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.\n\n| Parameters ||\n|---------|---------------------------------------------------------------------------------------------------|\n| `cert` | [X509Certificate](../../../../java/security/cert/X509Certificate.html#)!: X509Certificate |\n| `key` | [PrivateKey](../../../../java/security/PrivateKey.html#)!: PrivateKey for the certificate |\n| `alias` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: KeyStore alias |\n\n| Exceptions ||\n|--------------------------------------|--------------------------------------------|\n| `java.lang.IllegalArgumentException` | if either `cert`, `key` or `alias` is null |\n\nPublic methods\n--------------\n\n### destroy\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun destroy(): Unit\n```\n\nClears the references to the X.509 certificate, private key and the KeyStore alias in this object. \n\n### getAlias\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getAlias(): String!\n```\n\nReturns the KeyStore alias.\n\n| Return ||\n|-----------------------------------------------------------------------------------|--------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | the KeyStore alias |\n\n### getCertificate\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getCertificate(): X509Certificate!\n```\n\nReturns the X.509 certificate.\n\n| Return ||\n|--------------------------------------------------------------------------|---------------------|\n| [X509Certificate](../../../../java/security/cert/X509Certificate.html#)! | the X509Certificate |\n\n### getPrivateKey\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getPrivateKey(): PrivateKey!\n```\n\nReturns the PrivateKey.\n\n| Return ||\n|-----------------------------------------------------------|----------------|\n| [PrivateKey](../../../../java/security/PrivateKey.html#)! | the PrivateKey |\n\n### isDestroyed\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isDestroyed(): Boolean\n```\n\nDetermines if the references to the X.509 certificate and private key in this object have been cleared.\n\n| Return ||\n|------------------------------------------------------------------------------------|-----------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if X509Certificate and the PrivateKey are null |"]]