# EdECPrivateKey

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited Constants](https://developer.android.com/reference/java/security/interfaces/EdECPrivateKey#inhconstants)\|[Methods](https://developer.android.com/reference/java/security/interfaces/EdECPrivateKey#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/security/interfaces/EdECPrivateKey#inhmethods)  

# EdECPrivateKey

`
public


interface
EdECPrivateKey
`  
`


implements

`[EdECKey](https://developer.android.com/reference/java/security/interfaces/EdECKey)`,

`[PrivateKey](https://developer.android.com/reference/java/security/PrivateKey)`


`

|-----------------------------------------|
| java.security.interfaces.EdECPrivateKey |

<br />

*** ** * ** ***

An interface for an elliptic curve private key as defined by[RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA)](https://tools.ietf.org/html/rfc8032). These keys are distinct from the keys represented by`ECPrivateKey`, and they are intended for use with algorithms based on RFC 8032 such as the EdDSA`Signature`algorithm.

An Edwards-Curve private key is a bit string. This interface only supports bit string lengths that are a multiple of 8, and the key is represented using a byte array.

## Summary

|                                                                                                                                                                                                                                                                                                  ### Inherited constants                                                                                                                                                                                                                                                                                                   |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[java.security.PrivateKey](https://developer.android.com/reference/java/security/PrivateKey) |--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `long` | [serialVersionUID](https://developer.android.com/reference/java/security/PrivateKey#serialVersionUID) *This constant was deprecated in API level 34. A`serialVersionUID`field in an interface is ineffectual. Do not use; no replacement.* | |
| From interface[java.security.Key](https://developer.android.com/reference/java/security/Key) |--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `long` | [serialVersionUID](https://developer.android.com/reference/java/security/Key#serialVersionUID) *This constant was deprecated in API level 34. A`serialVersionUID`field in an interface is ineffectual. Do not use; no replacement.* |                             |

|                                                                                                                           ### Public methods                                                                                                                            ||
|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract `[Optional](https://developer.android.com/reference/java/util/Optional)`<byte[]>` | ` `[getBytes](https://developer.android.com/reference/java/security/interfaces/EdECPrivateKey#getBytes())`() ` Get a copy of the byte array representing the private key. |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[java.security.interfaces.EdECKey](https://developer.android.com/reference/java/security/interfaces/EdECKey)` ` |-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[NamedParameterSpec](https://developer.android.com/reference/java/security/spec/NamedParameterSpec) | ` `[getParams](https://developer.android.com/reference/java/security/interfaces/EdECKey#getParams())`() ` Returns the algorithm parameters associated with the key. | ||
| From interface` `[javax.security.auth.Destroyable](https://developer.android.com/reference/javax/security/auth/Destroyable)` ` |--------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default void`    | ` `[destroy](https://developer.android.com/reference/javax/security/auth/Destroyable#destroy())`() ` Destroy this`Object`.                                | | ` default boolean` | ` `[isDestroyed](https://developer.android.com/reference/javax/security/auth/Destroyable#isDestroyed())`() ` Determine if this`Object`has been destroyed. | ||
| From interface` `[java.security.Key](https://developer.android.com/reference/java/security/Key)` ` |--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getAlgorithm](https://developer.android.com/reference/java/security/Key#getAlgorithm())`() ` Returns the standard algorithm name for this key.                                                     | | ` abstract byte[]`                                                             | ` `[getEncoded](https://developer.android.com/reference/java/security/Key#getEncoded())`() ` Returns the key in its primary encoding format, or null if this key does not support encoding.            | | ` abstract `[String](https://developer.android.com/reference/java/lang/String) | ` `[getFormat](https://developer.android.com/reference/java/security/Key#getFormat())`() ` Returns the name of the primary encoding format of this key, or null if this key does not support encoding. | ||

## Public methods

### getBytes

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public abstract Optional<byte[]> getBytes ()
```

Get a copy of the byte array representing the private key. This method may return an empty`Optional`if the implementation is not willing to produce the private key value.

<br />

|                                                                                              Returns                                                                                              ||
|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
| [Optional](https://developer.android.com/reference/java/util/Optional)`<byte[]>` | an`Optional`containing the private key byte array. If the key is not available, then an empty`Optional`. <br /> |