---
title: "randomAccessDecryptionStream(readingFrom:encryptionContext:allocationLimit:flags:threadCount:)"
framework: applearchive
role: symbol
role_heading: Type Method
path: "applearchive/archivebytestream/randomaccessdecryptionstream(readingfrom:encryptioncontext:allocationlimit:flags:threadcount:)"
---

# randomAccessDecryptionStream(readingFrom:encryptionContext:allocationLimit:flags:threadCount:)

Creates a decryption random access input stream.

## Declaration

```swift
static func randomAccessDecryptionStream(readingFrom encryptedStream: ArchiveByteStream, encryptionContext context: ArchiveEncryptionContext, allocationLimit: Int = Int.max, flags: ArchiveFlags = [], threadCount: Int = 0) -> ArchiveByteStream?
```

## Parameters

- `encryptedStream`: An input stream that provides encrypted and compressed data.
- `context`: Encryption context that provides options and credentials.
- `allocationLimit`: The requested memory allocation size in bytes. Set to 0 for lowest memory footprint or doc://com.apple.documentation/documentation/Swift/Int/max for best performance.
- `flags`: Flags that control the behavior of the operation.
- `threadCount`: The number of worker threads that the operation uses, set to 0 for default.

## Return Value

Return Value A new archive byte stream.

## See Also

### Decrypting Data

- [decryptionStream(readingFrom:encryptionContext:flags:threadCount:)](applearchive/archivebytestream/decryptionstream(readingfrom:encryptioncontext:flags:threadcount:).md)
