How to get external encryption url for iOS working when provided through API.

I have setup an wowza to ingest a live stream coming from ffmpeg using srtp protocol.

ffmpeg.exe -re -stream_loop -1 -i C:\Work\Orion\Wowza\1.mp4 -an -vcodec copy -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params "NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj" "srtp://127.0.0.1:55555" -vn -acodec copy -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params "NzB4d1BINUAvLEw6UzF3WSJ+PSdFcGdUJShpX1Zj" "srtp://127.0.0.1:55558"

I copied the sdp generated to live application and I am able to view the stream from my iPad. Now I want to ensure that the HLS stream to iPad is encrypted. The encryption works if I follow the steps under Key Files. If I create key files and give a valid url for the players I am able to verify on the iPad that the stream is encrypted and I am able to play it back.

What I want to do now is to provide the encryption settings to wowza from Java API. When I follow On-the-fly encryption with Wowza server-side API and insert the encryption key and encryption url for player using code these settings are never applied on the HLS stream. I can confirm that the onHTTPCupertinoEncryptionKeyLiveChunk method in the code is called as I can see in the logs that are generated. But when I play the stream in iPad there is no encryption that has taken place. Also, my external url is never called. Has someone been able to set the key info using Java API only without needing to create a key file physically on the hard disk.