<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppleArchive",
  "identifier" : "/documentation/AppleArchive/ArchiveByteStream/randomAccessDecryptionStream(readingFrom:encryptionContext:allocationLimit:flags:threadCount:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Apple Archive",
      "AppleArchive"
    ],
    "preciseIdentifier" : "s:12AppleArchive0B10ByteStreamC022randomAccessDecryptionD011readingFrom17encryptionContext15allocationLimit5flags11threadCountACSgAC_AA0b10EncryptionK0CSiAA0B5FlagsVSitFZ"
  },
  "title" : "randomAccessDecryptionStream(readingFrom:encryptionContext:allocationLimit:flags:threadCount:)"
}
-->

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

Creates a decryption random access input stream.

```
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

A new archive byte stream.

---

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)