---
title: "sign(encryptedStream:encryptionContext:)"
framework: applearchive
role: symbol
role_heading: Type Method
path: "applearchive/archiveencryptioncontext/sign(encryptedstream:encryptioncontext:)"
---

# sign(encryptedStream:encryptionContext:)

Signs an encrypted archive using the credentials stored in the specified encryption context.

## Declaration

```swift
static func sign(encryptedStream: ArchiveByteStream, encryptionContext context: ArchiveEncryptionContext) throws
```

## Parameters

- `encryptedStream`: A read-write byte stream that points to an encrypted archive.
- `context`: The encryption context that provides the credentials.

## Discussion

Discussion Close the encrypted stream before calling this function, and create the archive with a signatureMode other than none. Create the context that you pass to this function from the same archive and it must contain the signature encryption key and the signing private key.

## See Also

### Signing an encryption context

- [signatureMode](applearchive/archiveencryptioncontext/signaturemode-swift.property.md)
- [ArchiveEncryptionContext.SignatureMode](applearchive/archiveencryptioncontext/signaturemode-swift.struct.md)
