# KeyStore.TrustedCertificateEntry

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

# TrustedCertificateEntry

```
class TrustedCertificateEntry : KeyStore.Entry
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                   ||
| ↳ | [java.security.KeyStore.TrustedCertificateEntry](https://developer.android.com/reference/kotlin/java/security/KeyStore.TrustedCertificateEntry#) |

A`KeyStore`entry that holds a trusted`Certificate`.

## Summary

|                                                                                                                                                                                                                                                                                                                                 Public constructors                                                                                                                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [TrustedCertificateEntry](https://developer.android.com/reference/kotlin/java/security/KeyStore.TrustedCertificateEntry#TrustedCertificateEntry(java.security.cert.Certificate))`(`trustedCert:` `[Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate)!`)` Constructs a`TrustedCertificateEntry`with a trusted`Certificate`.                                                                                                                                                                                                                                                                                                             |
| [TrustedCertificateEntry](https://developer.android.com/reference/kotlin/java/security/KeyStore.TrustedCertificateEntry#TrustedCertificateEntry(java.security.cert.Certificate,%20kotlin.collections.MutableSet))`(`trustedCert:` `[Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate)!`, `attributes:` `[MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[KeyStore.Entry.Attribute](https://developer.android.com/reference/kotlin/java/security/KeyStore.Entry.Attribute)!>!`)` Constructs a`TrustedCertificateEntry`with a trusted`Certificate`and associated entry attributes. |

|                                                                                                                                                                                                        Public methods                                                                                                                                                                                                         ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[KeyStore.Entry.Attribute](https://developer.android.com/reference/kotlin/java/security/KeyStore.Entry.Attribute)!\>! | [getAttributes](https://developer.android.com/reference/kotlin/java/security/KeyStore.TrustedCertificateEntry#getAttributes())`()` Retrieves the attributes associated with an entry.           |
| [Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate)!                                                                                                                                | [getTrustedCertificate](https://developer.android.com/reference/kotlin/java/security/KeyStore.TrustedCertificateEntry#getTrustedCertificate())`()` Gets the trusted`Certficate`from this entry. |
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)                                                                                                                                             | [toString](https://developer.android.com/reference/kotlin/java/security/KeyStore.TrustedCertificateEntry#toString())`()` Returns a string representation of this TrustedCertificateEntry.       |

## Public constructors

### TrustedCertificateEntry

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

```
TrustedCertificateEntry(trustedCert: Certificate!)
```

Constructs a`TrustedCertificateEntry`with a trusted`Certificate`.

|                                                              Parameters                                                               ||
|---------------|------------------------------------------------------------------------------------------------------------------------|
| `trustedCert` | [Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate)!:the trusted`Certificate` |

|                        Exceptions                         ||
|----------------------------------|-------------------------|
| `java.lang.NullPointerException` | if`trustedCert`is`null` |

### TrustedCertificateEntry

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

```
TrustedCertificateEntry(
    trustedCert: Certificate!, 
    attributes: MutableSet<KeyStore.Entry.Attribute!>!)
```

Constructs a`TrustedCertificateEntry`with a trusted`Certificate`and associated entry attributes.

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

|                                                                                                                         Parameters                                                                                                                         ||
|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `trustedCert` | [Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate)!:the trusted`Certificate`                                                                                                                      |
| `attributes`  | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[KeyStore.Entry.Attribute](https://developer.android.com/reference/kotlin/java/security/KeyStore.Entry.Attribute)!\>!:the attributes |

|                               Exceptions                                ||
|----------------------------------|---------------------------------------|
| `java.lang.NullPointerException` | if`trustedCert`or`attributes`is`null` |

## Public methods

### getAttributes

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

```
fun getAttributes(): MutableSet<KeyStore.Entry.Attribute!>!
```

Retrieves the attributes associated with an entry.

|                                                                                                                                    Return                                                                                                                                     ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)<[KeyStore.Entry.Attribute](https://developer.android.com/reference/kotlin/java/security/KeyStore.Entry.Attribute)!>! | an unmodifiable`Set`of attributes, possibly empty |

### getTrustedCertificate

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

```
fun getTrustedCertificate(): Certificate!
```

Gets the trusted`Certficate`from this entry.

|                                                                 Return                                                                 ||
|-----------------------------------------------------------------------------------------------|-----------------------------------------|
| [Certificate](https://developer.android.com/reference/kotlin/java/security/cert/Certificate)! | the trusted`Certificate`from this entry |

### toString

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

```
fun toString(): String
```

Returns a string representation of this TrustedCertificateEntry.

|                                                                   Return                                                                   ||
|----------------------------------------------------------------------------------|----------------------------------------------------------|
| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | a string representation of this TrustedCertificateEntry. |