International       English      China       
加密软件网DRM Plus视频加密方案
首页 SmartPhone DRM加密方案列表 DRM演示中心 软件定制服务 加密狗 国际软件 联系我们
 
视频路径加密的方法   返回

public class SafeString
{
private string iv = "12345678"; //种子
private string key = "12345678"; //加密密钥
private Encoding encoding = new UnicodeEncoding(); //定义一个字符串编码格式对象
private DES des = null; //定义一个加密算法类对象——此类是有.NET Framework 提供的众多加密算法中的一种

/// <summary>
/// 构造函数
/// </summary>
public SafeString() {
des = new DESCryptoServiceProvider();
}

/// <summary>
/// 设置或获取加密密钥
/// </summary>
public string EncryptKey
{
set { this.key = value; }
}

/// <summary>
/// 要加密字符的编码模式
/// </summary>
public Encoding EncodingMode
{
get { return this.encoding; }
set { this.encoding = value;}
}

/// <summary>
/// 加密字符串,并返回加密后的结果
/// </summary>
/// <param name="str">要加密的字符串</param>
/// <returns></returns>
public string EncryptString(string str)
{
byte[] ivb = Encoding.ASCII.GetBytes(this.iv); //将指定字符串中的所有字符编码为一个字节序列
byte[] keyb = Encoding.ASCII.GetBytes(this.key); //得到加密密钥——将指定对象转化为一个字节序列
byte[] toEncrypt = this.EncodingMode.GetBytes(str); //得到要加密的内容——将指定对象转化为一个字节序列
byte[] encrypted; //保存加密后的字符串字节序列

//DES 加密工具类
ICryptoTransform encryptor = des.CreateEncryptor(keyb, ivb); //定义基本的加密转化算法——创建对称加密器对象
MemoryStream msEncrypt = new MemoryStream(); //创建支持存储区为内存的流
CryptoStream csEncrypt = new CryptoStream(msEncrypt,encryptor,CryptoStreamMode.Write); //定义将数据流链接到加密转换的流

csEncrypt.Write(toEncrypt,0,toEncrypt.Length);
csEncrypt.FlushFinalBlock();
encrypted = msEncrypt.ToArray();
csEncrypt.Close(); //关闭两个流对象
msEncrypt.Close();
return Convert.ToBase64String(encrypted); //将8位无符号整数数组转化为64位等效字符串
}

/// <summary>
/// 解密给定的字符串
/// </summary>
/// <param name="str">要解密的字符串</param>
/// <returns></returns>
public string DecryptString(string str)
{
byte[] ivb = Encoding.ASCII.GetBytes(this.iv);
byte[] keyb = Encoding.ASCII.GetBytes(this.key);
byte[] toDecrypt = Convert.FromBase64String(str);
byte[] deCrypted = new byte[toDecrypt.Length];

//DES 加密工具类
ICryptoTransform deCryptor = des.CreateDecryptor(keyb, ivb); //定义基本的加密转化算法——创建对称解密器对象
MemoryStream msDecrypt = new MemoryStream(toDecrypt);
CryptoStream csDecrypt = new CryptoStream(msDecrypt, deCryptor, CryptoStreamMode.Read);

try
{
csDecrypt.Read(deCrypted, 0, deCrypted.Length);
}
catch (Exception err)
{
throw new ApplicationException(err.Message);
}
finally
{
try
{
msDecrypt.Close();
csDecrypt.Close();
}
catch (Exception)
{ ;}
}
return this.EncodingMode.GetString(deCrypted);
}

 

}


<script LANGUAGE="javaScript">
var ERR_NonePlayer="播放器提示您:您的系统中没有安装Real Player播放器,请在主页上下载。\n\nMovie播放器将关闭。";
var ERR_FileNotFind="播放器提示您:无法播放本影片,请刷新页面重试,如果仍然不能播放请通知我们,我们会尽快处理好。";
var ERR_NotLocateServer="播放器提示您:无法播放本影片,请刷新页面重试,如果仍然不能播放请通知我们,我们会尽快处理好。";
var ERR_UnkownError="播放器提示您:无法播放本影片,请刷新页面重试,如果仍然不能播放请通知我们,我们会尽快处理好。";
</script>
<script LANGUAGE="VBScript">
on error resume next
RealPlayerG2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))\n');
RealPlayer5 = (NOT IsNull(CreateObject("RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)")))
RealPlayer4 = (NOT IsNull(CreateObject("RealVideo.RealVideo(tm) ActiveX Control (32-bit)")))
if not RealPlayerG2 and RealPlayer5 and RealPlayer4 then
if MsgBox("您的浏览?薹ㄗ远略?新的浏览器插件,是否要下载播放器来播放?", vbYesNo) = vbYes then
window.location = "http://free-dl.cn.real.com/free/windows/installer/stubinst/stub/rp14/R61CND/RealPlayer_cn.exe"
end if
end if
Sub player_OnBuffering(lFlags,lPercentage)
if (lPercentage=100) then
StartPlay=false
if (FirstPlay) then
FirstPlay=false
end if
exit sub
end if
End Sub
Sub player_OnErrorMessage(uSeverity, uRMACode, uUserCode, pUserString, pMoreInfoURL, pErrorString)
select case document.getElementById("player").GetLastErrorRMACode()
case -2147221496
window.alert(ERR_FileNotFind)
case -2147221433,-2147221428,-2147221417,-2147217468
window.alert(ERR_NotLocateServer)
case else
window.alert(ERR_UnkownError)
end select
End Sub
Sub sendHttp(objURL)
set oSend = createobject("Microsoft.XMLHTTP")
SourceCode = oSend.open ("GET",objURL,false)
oSend.send()
set oSend=nothing
end Sub
</script>

<TABLE id="table16" height="410" cellSpacing="0" cellPadding="0" width="618" align="center"
border="0">
<TR>
<TD vAlign="middle" align="center" height="394">
<object id="player" name="player" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="100%" height="100%">
<param name="_ExtentX" value="13123">
<param name="_ExtentY" value="8678">
<param name="AUTOSTART" value="0">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="0">
<param name="CONTROLS" value="Imagewindow">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object>
</TD>
</TR>
</TABLE>
<TABLE id="table17" height="57" cellSpacing="0" cellPadding="0" width="618" align="center"
border="0">
<TR>
<TD align="center" bgColor="#000000">
<TABLE id="table18" cellSpacing="0" cellPadding="0" width="100%" border="1">
<TR>
<TD width="50"><A href="#"><IMG onclick="document.player.SetFullScreen()" height="30" alt="如果你窗口播放效果不好,请改用全屏方式播放。"
src="images/player/ctrl-fullscreen.gif" width="50" border="0"></A></TD>
<TD>
<object ID="RP2" CLASSID="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" height="30" width="100%">
<param name="_ExtentX" value="8334">
<param name="_ExtentY" value="661">
<param name="AUTOSTART" value="-1">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="-1">
<param name="SRC" value="GetMovieUrl.aspx">
<param name="CONTROLS" value="ControlPanel">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object>
<script language="javascript">
document.getElementById("player").SetEnableContextMenu(false);
document.getElementById("player").SetWantErrors(true);
</script>


</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD align="center" bgColor="#000000" style="height: 16px">
<object classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA id="RP3" name="RP3" height="30" width="100%" >
<param name="_ExtentX" value="13018">
<param name="_ExtentY" value="661">
<param name="AUTOSTART" value="0">
<param name="SHUFFLE" value="0">
<param name="PREFETCH" value="0">
<param name="NOLABELS" value="0">
<param name="CONTROLS" value="StatusBar">
<param name="CONSOLE" value="clip1">
<param name="LOOP" value="0">
<param name="NUMLOOP" value="0">
<param name="CENTER" value="0">
<param name="MAINTAINASPECT" value="0">
<param name="BACKGROUNDCOLOR" value="#000000">
</object>
</TD>
</TR>
</TABLE>




drmsoft.cn All Rights Reserved.