Stay organized with collections
Save and categorize content based on your preferences.
EdECPrivateKeySpec
class EdECPrivateKeySpec : KeySpec
A class representing elliptic curve private keys as defined in RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA), including the curve and other algorithm parameters. The private key is a bit string represented using a byte array. This class only supports bit string lengths that are a multiple of 8.
Summary
Public constructors |
Construct a private key spec using the supplied parameters and bit string.
|
Public methods |
ByteArray |
Get the byte array representing the private key.
|
NamedParameterSpec |
Get the algorithm parameters that define the curve and other settings.
|
Public constructors
EdECPrivateKeySpec
EdECPrivateKeySpec(
params: NamedParameterSpec,
bytes: ByteArray)
Construct a private key spec using the supplied parameters and bit string.
Parameters |
params |
NamedParameterSpec: the algorithm parameters. |
bytes |
ByteArray: the key as a byte array. This array is copied to protect against subsequent modification. |
Exceptions |
java.lang.NullPointerException |
if params or bytes is null. |
Public methods
getBytes
fun getBytes(): ByteArray
Get the byte array representing the private key. A new copy of the array is returned each time this method is called.
Return |
ByteArray |
the private key as a byte array. |
getParams
fun getParams(): NamedParameterSpec
Get the algorithm parameters that define the curve and other settings.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# EdECPrivateKeySpec\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nEdECPrivateKeySpec\n==================\n\n```\nclass EdECPrivateKeySpec : KeySpec\n```\n\n|---|--------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [java.security.spec.EdECPrivateKeySpec](#) |\n\nA class representing elliptic curve private keys as defined in [RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)](https://tools.ietf.org/html/rfc8032), including the curve and other algorithm parameters. The private key is a bit string represented using a byte array. This class only supports bit string lengths that are a multiple of 8.\n\nSummary\n-------\n\n| Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| [EdECPrivateKeySpec](#EdECPrivateKeySpec(java.security.spec.NamedParameterSpec,%20kotlin.ByteArray))`(`params:` `[NamedParameterSpec](/reference/kotlin/java/security/spec/NamedParameterSpec)`, `bytes:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`)` Construct a private key spec using the supplied parameters and bit string. |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | [getBytes](#getBytes())`()` Get the byte array representing the private key. |\n| [NamedParameterSpec](/reference/kotlin/java/security/spec/NamedParameterSpec) | [getParams](#getParams())`()` Get the algorithm parameters that define the curve and other settings. |\n\nPublic constructors\n-------------------\n\n### EdECPrivateKeySpec\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nEdECPrivateKeySpec(\n params: NamedParameterSpec, \n bytes: ByteArray)\n```\n\nConstruct a private key spec using the supplied parameters and bit string.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `params` | [NamedParameterSpec](/reference/kotlin/java/security/spec/NamedParameterSpec): the algorithm parameters. |\n| `bytes` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html): the key as a byte array. This array is copied to protect against subsequent modification. |\n\n| Exceptions ||\n|----------------------------------|---------------------------------|\n| `java.lang.NullPointerException` | if `params` or `bytes` is null. |\n\nPublic methods\n--------------\n\n### getBytes\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getBytes(): ByteArray\n```\n\nGet the byte array representing the private key. A new copy of the array is returned each time this method is called.\n\n| Return ||\n|-----------------------------------------------------------------------------------------|----------------------------------|\n| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html) | the private key as a byte array. |\n\n### getParams\n\nAdded in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getParams(): NamedParameterSpec\n```\n\nGet the algorithm parameters that define the curve and other settings.\n\n| Return ||\n|-------------------------------------------------------------------------------|---------------------------|\n| [NamedParameterSpec](/reference/kotlin/java/security/spec/NamedParameterSpec) | the algorithm parameters. |"]]