Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#pubctors) \| [Methods](https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#inhmethods)

# KeyStore.SecretKeyEntry


`
public
static
final

class
KeyStore.SecretKeyEntry
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/java/security/KeyStore.Entry


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.security.KeyStore.SecretKeyEntry |

<br />

*** ** * ** ***

A `KeyStore` entry that holds a `SecretKey`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#SecretKeyEntry(javax.crypto.SecretKey)(https://developer.android.com/reference/javax/crypto/SecretKey secretKey) ` Constructs a `SecretKeyEntry` with a `SecretKey`. |
| ` https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#SecretKeyEntry(javax.crypto.SecretKey,%20java.util.Set<java.security.KeyStore.Entry.Attribute>)(https://developer.android.com/reference/javax/crypto/SecretKey secretKey, https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/security/KeyStore.Entry.Attribute> attributes) ` Constructs a `SecretKeyEntry` with a `SecretKey` and associated entry attributes. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/security/KeyStore.Entry.Attribute>` | ` https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#getAttributes()() ` Retrieves the attributes associated with an entry. |
| ` https://developer.android.com/reference/javax/crypto/SecretKey` | ` https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#getSecretKey()() ` Gets the `SecretKey` from this entry. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/security/KeyStore.SecretKeyEntry#toString()() ` Returns a string representation of this SecretKeyEntry. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/java/security/KeyStore.Entry ` |---|---| | ` default https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/security/KeyStore.Entry.Attribute>` | ` https://developer.android.com/reference/java/security/KeyStore.Entry#getAttributes()() ` Retrieves the attributes associated with an entry. | ||

## Public constructors

### SecretKeyEntry

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

```
public SecretKeyEntry (SecretKey secretKey)
```

Constructs a `SecretKeyEntry` with a
`SecretKey`.

<br />

| Parameters ||
|---|---|
| `secretKey` | `SecretKey`: the `SecretKey` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `secretKey` is `null` |

### SecretKeyEntry

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

```
public SecretKeyEntry (SecretKey secretKey, 
                Set<KeyStore.Entry.Attribute> attributes)
```

Constructs a `SecretKeyEntry` with a `SecretKey` and
associated entry attributes.

The specified `attributes` is cloned before it is stored
in the new `SecretKeyEntry` object.

<br />

| Parameters ||
|---|---|
| `secretKey` | `SecretKey`: the `SecretKey` <br /> |
| `attributes` | `Set`: the attributes <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException` | if `secretKey` or `attributes` is `null` |

## Public methods

### getAttributes

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

```
public Set<KeyStore.Entry.Attribute> getAttributes ()
```

Retrieves the attributes associated with an entry.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/security/KeyStore.Entry.Attribute>` | an unmodifiable `Set` of attributes, possibly empty <br /> |

### getSecretKey

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

```
public SecretKey getSecretKey ()
```

Gets the `SecretKey` from this entry.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/javax/crypto/SecretKey` | the `SecretKey` from this entry <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of this SecretKeyEntry.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of this SecretKeyEntry. <br /> |