First of all you need a CSharp compiler (csc).
If you save the following file
Code:
// A Chilkat Crypt unlock code will work here.
Chilkat.OmaDrm omaDrm = new Chilkat.OmaDrm();
omaDrm.UnlockComponent("Anything for 30-day trial");
Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
// Load an OMA DRM file.
omaDrm.LoadDcfFile("orval2.dcf");
string msg = omaDrm.ContentType + "\r\n" +
omaDrm.ContentUri + "\r\n" +
omaDrm.Headers;
MessageBox.Show(msg);
// Get a specific header
MessageBox.Show("Content-Description = " + omaDrm.GetHeaderField("content-description"));
// Get the AES initialization vector
// Display the IV in hex format.
MessageBox.Show("IV: " + crypt.Encode(omaDrm.IV, "hex"));
// Display 1st 20 bytes of encrypted data in hex format
MessageBox.Show("Encrypted Data: " + crypt.Encode(omaDrm.EncryptedData, "hex").Substring(0,20));
// To decrypt, set the Base64 key and decrypt...
omaDrm.Base64Key = "BiVVJOQee6y4PWYL+fbvJA==";
// Display 1st 20 bytes of the decrypted data in hex format
MessageBox.Show("Decrypted Data: " + crypt.Encode(omaDrm.DecryptedData,"hex").Substring(0,20));
// Save the decrypted data to a file.
bool success = omaDrm.SaveDecrypted("out.gif");
if (!success)
{
MessageBox.Show(omaDrm.LastErrorText);
}
as a dcfundrm.cs you may compile it using C# compiler (csc) from a command line:
Code:
csc dcfundrm.cs /r:ChilkatDotNet.dll
But you should place dcfundrm.cs and ChilkatDotNet.dll from
http://www.chilkatsoft.com/downloads.asp to the same directory (if I'm not mistaken).
You may also use /out switch to change .exe name:
Code:
csc /out:dcf_undrm.exe dcfundrm.cs /r:ChilkatDotNet.dll
Note that the code provided is just an example. It can open only file with a fixed filename orval2.dcf (you can change it in the code an recompile) and decrypt it to the file with the fixed filename out.gif.
p.s. Haven't done any C# coding for about 2 years. And I have never used command prompt to compile C# applications. So sorry for the possible mistakes.