Commit 18e6994b authored by ONLYOFFICE's avatar ONLYOFFICE

deleted unused code

parent 654bd6fb
......@@ -43,91 +43,7 @@ namespace FileConverterUtils2
public class LicenseUtils
{
#if !OPEN_SOURCE
public static Boolean VerifyXml(XmlDocument Doc, RSA Key)
{
if (Doc == null)
throw new ArgumentException("Doc");
if (Key == null)
throw new ArgumentException("Key");
SignedXml signedXml = new SignedXml(Doc);
XmlNodeList nodeList = Doc.GetElementsByTagName("Signature");
if (nodeList.Count <= 0)
{
throw new CryptographicException("Verification failed: No Signature was found in the document.");
}
if (nodeList.Count >= 2)
{
throw new CryptographicException("Verification failed: More that one signature was found for the document.");
}
signedXml.LoadXml((XmlElement)nodeList[0]);
return signedXml.CheckSignature(Key);
}
public static string symmetricDecrypt(byte[] content, byte[] keyAndIv)
{
RijndaelManaged RMCrypto = new RijndaelManaged();
KeySizes[] keySizes = RMCrypto.LegalKeySizes;
if (keySizes.Length == 0)
throw new InvalidOperationException("No Rijndael key sizes");
int keySize = (keySizes[0].MaxSize / 8);
int blockSize = (RMCrypto.BlockSize / 8);
byte[] Key = new byte[keySize];
byte[] IV = new byte[blockSize];
for (int i = 0; i < keySize; ++i)
{
Key[i] = (byte)i;
}
for (int i = 0; i < blockSize; ++i)
{
IV[i] = (byte)i;
}
if (keyAndIv.Length >= keySize)
{
Array.Copy(keyAndIv, Key, keySize);
}
else
{
Array.Copy(keyAndIv, Key, keyAndIv.Length);
}
if (keyAndIv.Length >= blockSize)
{
Array.Copy(keyAndIv, IV, blockSize);
}
else
{
Array.Copy(keyAndIv, IV, keyAndIv.Length);
}
MemoryStream stream = new MemoryStream(content);
CryptoStream cryptStream = new CryptoStream(stream
, RMCrypto.CreateDecryptor(Key, IV)
, CryptoStreamMode.Read);
StreamReader sReader = new StreamReader (cryptStream);
string res = sReader.ReadToEnd();
sReader.Close();
cryptStream.Close();
stream.Close();
return res;
}
#endif
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment