小编AJ1*_*152的帖子

为Windows应用程序实现webrtc数据通道

是否有任何机构知道如何将WebRTC DataChannel API实现到在C#中构建的Windows应用程序,以便在NAT后面的客户端之间发送TCP消息.这不适用于Web应用程序,它仅适用于Windows.

任何意见或想法都非常感谢.

谢谢.

c# tcp webrtc

16
推荐指数
2
解决办法
1万
查看次数

检查日期字符串是否大于 3 天

我需要一些有关 javascript 代码的帮助,如果第二个日期大于 3 天,我需要检查两个字符串日期值(第一个日期和第二个日期),我以字符串格式获取值mm/dd/yyyy。请帮忙。

var firstDate = '10/01/2019'
var secondDate = '10/04/2019'

if ((inputData.firstDate) + 3 === inputData.secondDate) {
  return {
    dateCheck: 'Not greater than 3 days'
  };
} else {
  return {
    dateCheck: 'Greater than 3 days'
  };
}
Run Code Online (Sandbox Code Playgroud)

javascript

5
推荐指数
2
解决办法
2142
查看次数

无法解密第二台计算机上的数据

我有两个应用程序,服务器和客户端,一个从一台机器运行,另一个从第二台机器运行,服务器使用WebSocket连接传递数据,数据在发送到客户端之前被加密,数据使其成为正确的客户端应用程序,但我正在尝试使用相同的安全方法和密钥解密它,但我不会工作,它只在两个应用程序从同一台计算机运行时解密它.有没有人知道为什么它们在从同一台机器上运行时有效,但在从不同的机器上运行时却没有?

服务器和客户端应用程序都使用相同的安全方法.

using System.Security.Cryptography;

// ENCRYPT

static byte[] entropy = System.Text.Encoding.Unicode.GetBytes("MY SECRET KEY HERE");

public static string EncryptString(System.Security.SecureString input)
{
    byte[] encryptedData = System.Security.Cryptography.ProtectedData.Protect(
        System.Text.Encoding.Unicode.GetBytes(ToInsecureString(input)),
        entropy,
        System.Security.Cryptography.DataProtectionScope.CurrentUser);
    return Convert.ToBase64String(encryptedData);
}

public static SecureString DecryptString(string encryptedData)
{
    try
    {
        byte[] decryptedData = System.Security.Cryptography.ProtectedData.Unprotect(
            Convert.FromBase64String(encryptedData),
            entropy,
            System.Security.Cryptography.DataProtectionScope.CurrentUser);
        return ToSecureString(System.Text.Encoding.Unicode.GetString(decryptedData));
    }
    catch
    {
        return new SecureString();
    }
}

public static SecureString ToSecureString(string input)
{
    SecureString secure = new SecureString();
    foreach (char c in input)
    {
        secure.AppendChar(c);
    }
    secure.MakeReadOnly();
    return secure;
}

public static …
Run Code Online (Sandbox Code Playgroud)

c# encryption cryptography

2
推荐指数
1
解决办法
4425
查看次数

无法将时间'Int'的值转换为Swift 2中的预期参数类型'NSPropertyListReadOptions'

我正在将现有代码升级到Swift 2,我需要一些帮助来保存Plist文件

这段代码在Xcode 6.3中工作,但现在使用Xcode 7和Swift 2,它显示了这个错误:

无法将时间'Int'的值转换为预期的参数类型'NSPropertyListReadOptions'(又名'NSPropertyListMutabilityOptions')

var resultValue = "Value goes here"


@IBAction func saveNote(sender: AnyObject) {
    // Save note to plist
    var appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
    var pathForThePlistFile = appDelegate.plistPathInDocument

    // Extract the content of the file as NSData
    var data:NSData =  NSFileManager.defaultManager().contentsAtPath(pathForThePlistFile)!
    // Convert the NSData to mutable array
    var notesArray = (try! NSPropertyListSerialization.propertyListWithData(data, options: Int(NSPropertyListMutabilityOptions.MutableContainersAndLeaves.rawValue), format: nil)) as! NSMutableArray
    //

    notesArray.addObject(resultValue)
    // Save to plist
    notesArray.writeToFile(pathForThePlistFile, atomically: true)
}
Run Code Online (Sandbox Code Playgroud)

请帮忙!

iphone ios xcode7 swift2

2
推荐指数
1
解决办法
3787
查看次数

标签 统计

c# ×2

cryptography ×1

encryption ×1

ios ×1

iphone ×1

javascript ×1

swift2 ×1

tcp ×1

webrtc ×1

xcode7 ×1