---
title: "setPairwiseMasterKey(_:)"
framework: corewlan
role: symbol
role_heading: Instance Method
path: "corewlan/cwinterface/setpairwisemasterkey(_:)"
---

# setPairwiseMasterKey(_:)

Sets the interface pairwise primary key (PMK).

## Declaration

```swift
func setPairwiseMasterKey(_ key: Data?) throws
```

## Parameters

- `key`: An NSData object containing the pairwise primary key (PMK).

## Discussion

Discussion key must be 32 octets. If key is nil, this method clears the PMK for the interface. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Setting interface parameters

- [setPower(_:)](corewlan/cwinterface/setpower(_:).md)
- [setWEPKey(_:flags:index:)](corewlan/cwinterface/setwepkey(_:flags:index:).md)
- [setWLANChannel(_:)](corewlan/cwinterface/setwlanchannel(_:).md)
