Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1005793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:21:14+00:00 2026-05-16T08:21:14+00:00

My app streams content (fixed sized files, hence quotation marks) from an HTTP server

  • 0

My app “streams” content (fixed sized files, hence quotation marks) from an HTTP server into a local file. Then there is another component of the app that opens that same file and displays it (plays it).

This is done for caching purposes, so that when the same file is requested next time, it will no longer need to be downloaded from the server.

App’s spec requires that all local content is encrypted (even with the most light weight encryption)

Question: has there been done any work, allowing one to simply redirect the stream to a library which will then save the stream encrypted into a file? And then, when I request the stream from the local file, the library returns an on the fly decrypted stream?

I’ve been searching for a solution with no results so far

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T08:21:15+00:00Added an answer on May 16, 2026 at 8:21 am

    I ended up writing a custom solution that uses RC4 encryption from the built in Crypt library. It was surprisingly straight forward. Basically it involved creating a function that encrypts/decrypts chunks of NSData and then read/write those chunks to files… Here’s the function that does the encryption in case someone else is interested:

    - (NSData*)RC4EncryptDecryptWithKey:(NSString *)key operation:(CCOperation)operation
    {
            // convert to C string..
            int keySize = [key length];
            char keyPtr[keySize];
            bzero(keyPtr, sizeof(keyPtr));
            [key getCString:keyPtr
                  maxLength:sizeof(keyPtr)
                   encoding:NSUTF8StringEncoding];
    
            // encode/decode
            NSUInteger dataLength = [self length];
            size_t bufferSize = dataLength;
            void *buffer = malloc(bufferSize);
    
            size_t numBytesOut = 0;
            CCCryptorStatus cryptStatus = CCCrypt(operation,
                                                  kCCAlgorithmRC4,
                                                  kCCOptionECBMode,
                                                  keyPtr,
                                                  8,
                                                  NULL,
                                                  [self bytes],
                                                  dataLength,
                                                  buffer,
                                                  bufferSize,
                                                  &numBytesOut);
            if (cryptStatus == kCCSuccess) {
                    return [NSData dataWithBytesNoCopy:buffer
                                                length:numBytesOut
                                          freeWhenDone:YES];
            }
    
            free(buffer);
            return nil;
    }
    
    - (NSData*)RC4EncryptWithKey:(NSString*)key {
       return [self RC4EncryptDecryptWithKey:key operation:kCCEncrypt];
    }
    
    - (NSData*)RC4DecryptWithKey:(NSString*)key {
       return [self RC4EncryptDecryptWithKey:key operation:kCCDecrypt];
    }
    

    Obviously one could create something more secure (eg AES) or whatever (in fact I used examples of other encryption wrappers to write this one)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using ACTION_SEND to send a file from the content provider in my app
In my node.js app I'm uploading a file (which is saved to local filesystem
I'm building a facebook connect app to publish content to user's streams. In order
I have a HTTP Live streaming server setup that serves segmented mp3 audio content
I am reading data from an IPhone App that uses http POST to transfer
I've written a simple Node.js app that streams content (primarily for videos, but other
I'm trying to open a txt file that's saved as content in my app,
I'm writing an iOS app that streams video and audio over the network. I
I am just messing around with an app that streams audio and I wanted
I have a great app for capturing shoutcast streams :-) . So far, it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.