How to read WMDRM 10 KEYID from file - drm

I wanted to if it is possible to read a KeyID from an encrypted file using WMDRM 10?
Of course it is a clear text somehow, but is it possible? how?
Thanks!

One easy answer is that you can binary-parse the file and look for the <WMRMHEADER> tag and the <KID> tag within it (both Unicode-encoded). The key ID is within the <KID> tag.
The correct (but much harder) way is to use Windows Media Format 11 SDK and the IWMDRMReader::GetDRMProperty() method with the g_wszWMDRM_DRMHeader_KeyID constant. However, you are gonna need WMDRM "stub libs" from Microsoft in order to do that (i.e. be a DRM licensee).

Using the WMF SDK is preferred, but another option is to implement ASF Parsing. The spec is available # http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=14995 and there are various implementations of ASF Parsers in different languages.

Related

Azure Media Services: Provide custom file names for the asset files

I'm encoding a video file using the built-in adaptive streaming transform. Once the file is successfully processed, an asset container is created with the below files:
Is it possible to provide custom file names at the time a job is created? It seems that the default behavior is to take a certain number of characters from the original file name and prepend them in the above file names. If possible, I'd like to configure this behavior.
P.S. I'm using the .NET SDK.
You can create a custom transform to output file names differently. On https://learn.microsoft.com/en-us/rest/api/media/transforms/createorupdate#definitions search for the Mp4Format section. In that you can specify the filenamePattern with certain macros like {Bitrate} and {Codec}.
See https://learn.microsoft.com/en-us/azure/media-services/latest/custom-preset-cli-howto for an example custom transform and the process by which to create it in Media Services.
I use the macros on my jobs, they work ok. I have a process that takes 3 videos (an intro section, the actual content, and the outro section) and encodes them as one single video. The issue I have with the macros is that it uses the file name of the first video in the inputs. So it ends up using the file name of the intro video which is a generic name. They need to have a way where we can have a little more control.
I suppose I could copy/rename the intro video to a desired name before I encode and it would pick it up, but that seems to be a little bit of overkill.
The Macros are good, but they could use some enhancements I think.

Updating the version info of a CHM file during compile with Inno [duplicate]

I need to add version info and retrieve it from the CHM file to make it possible to make an alert message to a user about a new CHM-file version available and downloaded.
It means, that I should compare versions of CHM on different machines (Server and clients).
The other way is date and time checking, but I should remember about time zones, so this is complicated, because also one should remember about different file systems, according to Windows SDK help about SetFileTime function and FILETIME structure.
If someone knows the trick - please share.
.chm files don't have version information. You will need to find some alternative way to mark the file version.
One way that occurs to me is to include a topic in the help file that contains the version. I imagine that this topic would be hidden, that is not linked by any other topic, not in the table of contents, etc.
All that remains is for your application to be able to read that topic from the help file. I'm sure that can be done with a .chm file parser, if you can obtain one. Perhaps more easily you can get the platform browser to read the topic for you. You can use IHTMLDocument2 to read a URI like this:
mk:#MSITStore:C:\somedir\somefile.chm::/html/SomeTopic.html

how to encode and decode pdf files using base64encode/decode ( windows app store )in c#

solution with sample using c#,
scenario:
Download encoded pdf file of base64Encode and decode(base64Decode) and store in ApplicationData.Current.LocalFolder;
you can use File.ReadAllBytes to load the PDF file into your program and then u can convert the loaded pdf file using Convert.ToBase64String(bytes) method
You might want to prefer this link
https://social.msdn.microsoft.com/forums/vstudio/en-US/e5965e02-0bbb-4f8d-9e5f-8611aa902457/how-to-convert-pdf-file-to-base64binary
Well, I am not going to write a solution with a complete sample for you, but I will point you to what may be the most exhaustive base42 discussion in Windows Runtime.
http://blog.jerrynixon.com/2014/11/reading-and-writing-base64-in-windows.html
It's a crazy coincidence that I just wrote this a few weeks ago. You'll notice that it is in the context of an image, but you should be able to translate it simple enough.
Remember to post your solution here!
Best of luck!

Parsing Excel files in monotouch

Are there any good ways of parsing Excel files in monotouch? Seems like most methods to work with Excel is based on using the Excel Object Library. Doesn't seem like that's even an option in monotouch? I read that objective-c doesn't have any native support for Excel-files, so don't know if that would change anything?
You would need to either
write your own
find an obj-c library that does it and write MT bindings for it
find a open source .NET library and port it to MT
If all you want to do is display a file, you can use the existing iOS document APIs to do it.
The newest Office formats are XML based, so depending on how complex the files are, writing your own parser might be feasible to do.
I ended up just writing the middle step, a web service that fetches the Excel file, parses it and serves up the content as xml/json.

How to generate application forms/documents programmatically?

At the moment, we use MS WORD and MS EXCEL to mail merge documents that needs to be sent to multiple recepients.
For example, say there is a complaint form where the complainant needs to fill in his/her name, address, etc. So we have a .doc file set up with the content and the dynamic entities set up for mail merging, with the name and address details put in an excel file, from where we can happily mail merge to generate all or just the necessary forms/documents.
However, I would like to automate this process, like a form in a website where the complainant can fill in his/her name, address and other details, and we could use that to generate the complaint form automatically and offer it to be downloaded (preferrably as a pdf).
Now, the only solution that comes to mind, is Latex, so that I can just replace the needed entities and just compile to PDF. However, that bit has to be negotiated with the webhost, if they are offering Latex or not.
Is there any other solution? Any other way we could get this done, with something that shouldn't be a problem for most webhosting solutions to offer?
EDIT: I would prefer a non .NET or rather non microsoft solution since, the servers are running linux and while mono might be capable of getting the job done, none of our devs know any .NET languages. However, if required we might have to dwelve into it.
Generating PDF using an XSL. Check the following: Apoc XSL-FO
You will need to create an XML file with the required fields and transform that with this tool.
If you wish to avoid .NET then XSL-FO is worth a look. Try the FOray project.
XSLT can be a steep learn if you do not have experience already. Also users will not be able to change the templates without asking the XSLT guru to do it.
If your templates are already in MS Word and MS Excel then I would stick with generating MS docs on the server. These are now easy to work with from code since OpenXML - check out OfficeOpenXML and OpenXMLDeveloper
Apache FOP : http://xmlgraphics.apache.org/fop/
I suggest generating rtf on the server: it's easy enough to automatically generate using cpan's RTF::Writer, has converters generating good pdf, can be edited by hand in word, oo-writer & TextEdit, doesn't have any really bad compatibility issues between the main editing applications, and has decent text & resource extraction tools, with text extraction being rather better than pdf.
There's some support for moving between rtf & latex, although the best rtf -> latex converter, docx2tex, depends on the System.IO.Packaging .net module, whose mono implementation isn't yet rock solid.
Postscript — Not a recommendation: it's too much of an unwieldy sledgehammer for this job, but iText will generate the pdf directly from the form data. If you wanted to do fancy things like signed pdf, that would be the way to go.
Postscript #2 — If you break up the Word document into individual files using word's master document representation, then you can clobber one of the parts with hand-generated content. This makes it easy to do something approximating form-filling on word .doc files using just standard file-utils and some trivial rtf->doc tweaking.

Resources