<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecKeyImportExportParameters/passphrase",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@SA@SecKeyImportExportParameters@FI@passphrase"
  },
  "title" : "passphrase"
}
-->

# passphrase

The password to use during key import or export.

```
var passphrase: Unmanaged<CFTypeRef>?
```

## Discussion

You may specify either a <doc://com.apple.documentation/documentation/CoreFoundation/CFString> or a <doc://com.apple.documentation/documentation/CoreFoundation/CFData> instance for the passphrase. The PKCS12 format requires passwords in Unicode format, and passing in a <doc://com.apple.documentation/documentation/CoreFoundation/CFString> as the password is the surest way to meet this requirement  (and ensure compatibility with other implementations). If you supply a <doc://com.apple.documentation/documentation/CoreFoundation/CFData> object as the password for a PKCS12 export operation, the data is assumed to be in UTF8 form and converted as appropriate.

When importing or exporting keys ([`SecKey`](/documentation/Security/SecKey) objects) in one of the wrapped formats ([`SecExternalFormat.formatWrappedOpenSSL`](/documentation/Security/SecExternalFormat/formatWrappedOpenSSL), [`SecExternalFormat.formatWrappedSSH`](/documentation/Security/SecExternalFormat/formatWrappedSSH), or [`SecExternalFormat.formatWrappedPKCS8`](/documentation/Security/SecExternalFormat/formatWrappedPKCS8)) or in PKCS12 format, you must either explicitly specify the passphrase field or set the [`securePassphrase`](/documentation/Security/SecKeyImportExportFlags/securePassphrase) bit the `flags` field (to prompt the user to enter the password).

---

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)