Stay organized with collections
Save and categorize content based on your preferences.
XdhKeySpec
class XdhKeySpec : EncodedKeySpec
External Diffie–Hellman (XDH) key spec holding either a public or private key.
Subclasses EncodedKeySpec
using the non-Standard "raw" format. The XdhKeyFactory class utilises this in order to create XDH keys from raw bytes and to return them as an XdhKeySpec allowing the raw key material to be extracted from an XDH key.
Summary
Public constructors |
Creates an instance of XdhKeySpec by passing a public or private key in its raw format.
|
Public methods |
Boolean |
|
String |
Returns the name of the encoding format associated with this key specification.
|
ByteArray |
Returns the public or private key in its raw format.
|
Int |
|
Public constructors
XdhKeySpec
XdhKeySpec(encoded: ByteArray)
Creates an instance of XdhKeySpec
by passing a public or private key in its raw format.
Parameters |
encoded |
ByteArray: This value cannot be null . |
Public methods
equals
fun equals(other: Any?): Boolean
Parameters |
obj |
the reference object with which to compare. |
Return |
Boolean |
true if this object is the same as the obj argument; false otherwise. |
fun getFormat(): String
Returns the name of the encoding format associated with this key specification.
If the opaque representation of a key (see Key
) can be transformed (see KeyFactory
) into this key specification (or a subclass of it), getFormat
called on the opaque key returns the same value as the getFormat
method of this key specification.
Return |
String |
This value cannot be null . |
getKey
fun getKey(): ByteArray
Returns the public or private key in its raw format.
Return |
ByteArray |
key in its raw format. This value cannot be null . |
hashCode
fun hashCode(): Int
Return |
Int |
a hash code value for this object. |
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,["# XdhKeySpec\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nXdhKeySpec\n==========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/crypto/hpke/XdhKeySpec \"View this page in Java\") \n\n```\nclass XdhKeySpec : EncodedKeySpec\n```\n\n|---|---|-------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||\n| ↳ | [java.security.spec.EncodedKeySpec](../../../java/security/spec/EncodedKeySpec.html#) ||\n| | ↳ | [android.crypto.hpke.XdhKeySpec](#) |\n\nExternal Diffie--Hellman (XDH) key spec holding either a public or private key.\n\nSubclasses `EncodedKeySpec` using the non-Standard \"raw\" format. The XdhKeyFactory class utilises this in order to create XDH keys from raw bytes and to return them as an XdhKeySpec allowing the raw key material to be extracted from an XDH key.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [XdhKeySpec](#XdhKeySpec(kotlin.ByteArray))`(`encoded:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Creates an instance of [XdhKeySpec](#) by passing a public or private key in its raw format. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [equals](#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` \u003cbr /\u003e |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getFormat](#getFormat())`()` Returns the name of the encoding format associated with this key specification. |\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | [getKey](#getKey())`()` Returns the public or private key in its raw format. |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [hashCode](#hashCode())`()` \u003cbr /\u003e |\n\n| Inherited functions ||\n|---|---|\n| From class [EncodedKeySpec](../../../java/security/spec/EncodedKeySpec.html#) |------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getAlgorithm](../../../java/security/spec/EncodedKeySpec.html#getAlgorithm())`()` Returns the name of the algorithm of the encoded key. \u003cbr /\u003e | | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)! | [getEncoded](../../../java/security/spec/EncodedKeySpec.html#getEncoded())`()` Returns the encoded key. \u003cbr /\u003e | ||\n\nPublic constructors\n-------------------\n\n### XdhKeySpec\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nXdhKeySpec(encoded: ByteArray)\n```\n\nCreates an instance of [XdhKeySpec](#) by passing a public or private key in its raw format.\n\n| Parameters ||\n|-----------|-----------------------------------------------------------------------------------------------------------------------|\n| `encoded` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): This value cannot be `null`. |\n\nPublic methods\n--------------\n\n### equals\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun equals(other: Any?): Boolean\n```\n\n| Parameters ||\n|-------|---------------------------------------------|\n| `obj` | the reference object with which to compare. |\n\n| Return ||\n|------------------------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if this object is the same as the obj argument; `false` otherwise. |\n\n### getFormat\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getFormat(): String\n```\n\nReturns the name of the encoding format associated with this key specification.\n\nIf the opaque representation of a key (see [Key](../../../java/security/Key.html#)) can be transformed (see [KeyFactory](../../../java/security/KeyFactory.html#)) into this key specification (or a subclass of it), `getFormat` called on the opaque key returns the same value as the `getFormat` method of this key specification.\n\n| Return ||\n|----------------------------------------------------------------------------------|------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | This value cannot be `null`. |\n\n### getKey\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getKey(): ByteArray\n```\n\nReturns the public or private key in its raw format.\n\n| Return ||\n|-----------------------------------------------------------------------------------------|-----------------------------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | key in its raw format. This value cannot be `null`. |\n\n### hashCode\n\nAdded in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun hashCode(): Int\n```\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |"]]