Is it possible to specify key value in m3u8 in stead of specifying a key file? - uri

As the title suggests, I'm wondering if it is possible to directly specify the key value in m3u8 in stead of specifying a key file. Hex value of the key file is 723C581D81C3316D89D3E1CB158FFF43 and VLC Player can playback the m3u8 when specifying the key file using URI="0.key". I've tried URI="data:text/plain;charset=utf-8,723C581D81C3316D89D3E1CB158FFF43" and didn't work. Not in favor of a separate key file, so if it's possible, what exactly should I put in the m3u8 as uri?

This is part of the HLS specs and what you have outlined above looks correct but I think you will find that Amy players don't actually support it.
For example an open ShakaPlayer request (at time of writing):
https://github.com/shaka-project/shaka-player/issues/2146
A similar issue with ExoPlayer:
https://stackoverflow.com/a/59625511/334402
You may find the easiest way is actually to host the key in a separate file, even though that is not your preferred approach.

Using base64 encoding seems to work for some implementations at least. VLC can't read it, but hls.js works properly.
First convert your hex key into base64:
> echo '723C581D81C3316D89D3E1CB158FFF43' | xxd -r -p | base64
cjxYHYHDMW2J0+HLFY//Qw==
Then use the base64 string as the key URI in your m3u8 file:
URI="data:text/plain;base64,cjxYHYHDMW2J0+HLFY//Qw=="

Related

QR Code URL data not readable or encrypted

There is an app which I use, which can read the name of a location from a qr code.
Recently, the qr code was changed so that the name of the location is no longer readable by zxing or any other barcode reader that I can find. Instead, I get a long string of numbers and letters. (The data that I need comes after the '&ln=' or '&eln=' in the url that is returned.)
The first example below is the new qr code. It returns the following URL:
https://mysejahtera.malaysia.gov.my/qrscan?lId=62419209a90dcd50091c36cb&eln=TW9qaXRvJ3MgQmVlciBCYXI=&formType=REGULAR&isExternal=false
The second one returns this:
https://mysejahtera.malaysia.gov.my/qrscan?lId=5edc745eb9e6850245c07e4b&ln=Osdin_Lighting_Enterprise
The original app can read the long location string in both the encrypted and human readable format. I want to be able to do the same. For example, the location of the first url is "Mojito's Beer Bar." The original app can read this and displays it correctly.
My feeling is that there must be a private key encryption which the app used to decipher the code. However, is it possible that there is a simple reason that a normal barcode/qrcode reader can't get the plain readable location text?
All I am looking for here is some pointers of where I should be looking. I have the decompiled source code from the MySejahtera app and have been digging through it without any luck. I'm happy to share this if anyone would be willing to help.
The "encoded" URL contains the value TW9qaXRvJ3MgQmVlciBCYXI= for the attribute eln. This is obviously a Base64 encoded value.
If you run the value through a Base64 decoder (e.g. https://www.base64decode.org/), the result is:
Mojito's Beer Bar
Base64 doesn't specify what text encoding is used. But likely it is UTF-8.

File Name in Send Port with PGP Encryption

The File Name in the Send Port should be set with the mask like ABC.txt.pgp. Since I have used the PGP Encryption Component it is generating the File name like ABC.pgp.txt.pgp. But what I need is just the ABC.txt.pgp. How can be this be done. Any help is greatly appreciated.
Thanks
What you are seeing is the expected behavior. If you are referring to this:
https://code.msdn.microsoft.com/windowsdesktop/BizTalk-Sample-PGP-ebcbc8b2
or one of it's derivatives, it will internally modify FILE.ReceivedFileName to append .pgp if that property is set.
So, if you use just %SourceFileName%, you will likely get the desired result. Otherwise, you will have to explicitly set FILE.ReceivedFileName to ABC.txt somewhere before the PGP component.
You can also modify the source code to remove this behavior.
(Same Answer)
Thanks Johns-305. I included the Message assignment shape before the send shape and used the
SendMessage(FILE.ReceivedFileName) = "ABC.txt";
In the Send Port I used Filename as "%SourceFileName%". Now I get the filename as ABC.txt.pgp in the Send Port

Transforming the Default URI when using MLCP

I have a delimited file as input source to ingest data in marklogic using conten-pump through unix.There is no such column in the file that is unique throught to serve as the URI. Problem with this is that since duplicates(URI) is not possible, those records are skipped/overwritten for that particular URI.
The syntaxes available are:
-delimited_uri_id *my_column_name*
output_uri_prefix *my_prefix_string*
output_uri_suffix *my_suffix_string*
output_uri_replace pattern,'string'
The command for mlcp is:
bin/mlcp.sh import -host localhost -port 8042 -username name -password password-input_file_path hdfs://path/to/file -delimiter '|' -delimited_uri_id column_name-input_file_type delimited_text -mode distributed
The problem that lies here is that if I modify the above command and include:
-output_uri_prefix $(date +%s%N)
It takes the time(in nanoseconds) of execution of this command and prefixes for all URI.But that doesnt solve my problem since this value remains repeated. Same would happen for other options available too .What could be done to have all records ingested by the construction of unique URI for all records in some manner?
One way or another it is up to you to provide unique ids. For a delimited file the easiest answer might be to add a new column and populate it with a unique id, generated however you like.
Or you could use http://marklogic.github.io/recordloader/ DelimitedDataLoader with the special option ID_NAME=#AUTO. But keep in mind that ID_NAME=#AUTO will single-thread ingestion.

How do I list information for a GnuPG encrypted message?

I'm still working with GPG, as in this post:
How do I encrypt plaintext with GnuPG?
What I need now is to be able to list various info (e.g. all recipients) of an encrypted message without necessarily decrypting it. I've seen links to different commands like "--list-only", but nothing seems to work. Does anyone have an authoritative reference (or any input really) on this?
Best.
EDIT #1:
Clarification. --list-only will display all keys but your own (if it was encrypted to you). Basically I need to be able to determine if the item was encrypted to me so as to "file" it or take other action.
In order to see all keys (that are not hidden) that a block of encrypted data was encrypted to - including your own - you could simply make your secret-keyring unavailable, via something like this:
gpg --no-default-keyring --secret-keyring /dev/null -a --list-only
That tells gpg to not use any default keyrings (--no-default-keyring) if an invalid/missing keyring is specified, and then goes on to specify an invalid/missing secret-keyring (--secret-keyring /dev/null)

imagemagick with foreign characters

ImageMagick doesnt seem to work with foreign characters. I use the following code
It works fine until a letter in the path or the file has a foreign character. How do i convert images to thumbs on my asp.net site? Is there a plug in or another app or version i may use?
Process app = new Process();
app.StartInfo.FileName = #"bin\convert.exe";
app.StartInfo.Arguments = string.Format(#"""{0}"" -resize ""{2}"" ""{1}""", file, newfile, param);
app.Start();
app.WaitForExit();
I would change the name of the file. You probably want to be doing some conversion of the file name anyway to help keep yourself safe from attacks embedded in a file's name. It's usually a bad idea to launch a subprocess with any string that a user can control. If you're catching uploaded files, move them to some new name before running convert.exe - like a name generated from a uuid, for instance.
A workaround is to change the filename to something ascii safe then rename/move it to the name/path you want with full unicode characters.
Answering this question may not be helpful for now but it might be useful for someone.
Converting file path to UTF-8 encoding worked for me.

Resources