<!--
{
  "availability" : [
    "iOS: 26.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AccessoryTransportExtension",
  "identifier" : "/documentation/AccessoryTransportExtension/SecurityMessage/init(keyType:cipherSuite:version:key:supportedTransports:identifier:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Accessory Transport Extension"
    ],
    "preciseIdentifier" : "s:27AccessoryTransportExtension15SecurityMessageV7keyType11cipherSuite7version0F019supportedTransports10identifierA2C03KeyG0O_AC06CipherI0OAM7VersionO10Foundation4DataVSayAA0aB0OGSSSgtcfc"
  },
  "title" : "init(keyType:cipherSuite:version:key:supportedTransports:identifier:)"
}
-->

# init(keyType:cipherSuite:version:key:supportedTransports:identifier:)

Initializes a security message with key material and metadata.

```
init(keyType: SecurityMessage.KeyType, cipherSuite: SecurityMessage.CipherSuite, version: SecurityMessage.CipherSuite.Version, key: Data, supportedTransports: [AccessoryTransport] = [.bluetooth], identifier: String? = nil)
```

## Parameters

`keyType`

The type of key carried by this message.

`cipherSuite`

The cryptographic cipher suite to use for key exchange.

`version`

The cipher suite protocol version.

`key`

The key data to send.

`supportedTransports`

The transports the accessory supports for sending sensitive information. The default is Bluetooth only.

`identifier`

An optional Bluetooth identifier for deriving HPKE keys.

## Discussion

When initiating key exchange from your accessory, create a message with [`SecurityMessage.KeyType.publicKey`](/documentation/AccessoryTransportExtension/SecurityMessage/KeyType-swift.enum/publicKey) and your accessory’s public key. The system responds with a message containing [`SecurityMessage.KeyType.encapsulatedKey`](/documentation/AccessoryTransportExtension/SecurityMessage/KeyType-swift.enum/encapsulatedKey).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)