# EncryptedTopic

# EncryptedTopic

Artifact:[androidx.privacysandbox.ads:ads-adservices](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads)  
[View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ads/adservices/topics/EncryptedTopic.kt+class:androidx.privacysandbox.ads.adservices.topics.EncryptedTopic)  
Added in[1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic "View this page in Java")

<br />

```
@ExperimentalFeatures.Ext11OptIn
class EncryptedTopic
```

<br />

*** ** * ** ***

This class will be used to return encrypted topic cipher text along with necessary fields required to decrypt it.

Decryption of {@link EncryptedTopic#getEncryptedTopic()} should give json string for {@link Topic}. Example of decrypted json string: {@code { "taxonomy_version": 5, "model_version": 2, "topic_id": 10010 }}

Decryption of cipher text is expected to happen on the server with the corresponding algorithm and private key for the public key {@link EncryptedTopic#getKeyIdentifier()}}.

Detailed steps on decryption can be found on[Developer Guide](https://developer.android.com/design-for-safety/privacy-sandbox/guides/topics).

## Summary

|                                                                                                                                                                                                                                                         ### Public constructors                                                                                                                                                                                                                                                         |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [EncryptedTopic](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#EncryptedTopic(kotlin.ByteArray,kotlin.String,kotlin.ByteArray))`(` ` encryptedTopic: `[ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html)`,` ` keyIdentifier: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` encapsulatedKey: `[ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html) `)` |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#hashCode())`()`                                                                                            |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#toString())`()`                                                                                            |

|                                  ### Public properties                                   |
|------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html) | [encapsulatedKey](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#encapsulatedKey()) |
| [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html) | [encryptedTopic](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#encryptedTopic())   |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)        | [keyIdentifier](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/topics/EncryptedTopic#keyIdentifier())     |

## Public constructors

### EncryptedTopic

Added in[1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)  

```
EncryptedTopic(
    encryptedTopic: ByteArray,
    keyIdentifier: String,
    encapsulatedKey: ByteArray
)
```  

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```  

### hashCode

```
open fun hashCode(): Int
```  

### toString

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

## Public properties

### encapsulatedKey

Added in[1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)  

```
val encapsulatedKey: ByteArray
```  

### encryptedTopic

Added in[1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)  

```
val encryptedTopic: ByteArray
```  

### keyIdentifier

Added in[1.1.0-beta12](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.1.0-beta12)  

```
val keyIdentifier: String
```