public void ShouldGenerateKeys() { const string nodeid = "node-1"; MockKeyStore ks = new MockKeyStore(); PayloadSigner ps = new PayloadSigner(nodeid, ks); string pubkey = ps.GenerateKeys(); // Keys should be present Assert.NotNull(ks.Salt); Assert.NotNull(ks.Key); // public key should be present Assert.NotNull(pubkey); // keys should be of proper size Assert.Equal(8, ks.Salt.Length); // Salt has to be 64 bits / 8 bytes Assert.Equal(3104, ks.Key.Length); // key has to be 3104 bytes (CSP blob) // public key should be base64 bool isBase64 = false; try { var result = Convert.FromBase64String(pubkey); isBase64 = true; } catch { // ignore catch - decode failed. assert below } Assert.True(isBase64, "Is Public key base64"); }
public RealTimeTelemetryManagerTests() { PayloadSigner sig = new PayloadSigner( "4816d758dd37833a3a5551001dac8a5fa737a342", new FileKeyStore("./")); string pubkey = sig.GenerateKeys(); _ftpMgr = new FtpManager("foo", "pass", "127.0.0.1", 2222, "78:72:96:8e:ad:ac:8c:31:57:b4:80:ba:2d:e4:88:9d", "/upload/dropzone/"); }
public FtpManagerTests() { PayloadSigner sig = new PayloadSigner( "4816d758dd37833a3a5551001dac8a5fa737a342", new FileKeyStore("./")); string pubkey = sig.GenerateKeys(); _ftpHost = "127.0.0.1"; _ftpPort = 2222; _userName = "******"; _password = "******"; _fingerPrint = "78:72:96:8e:ad:ac:8c:31:57:b4:80:ba:2d:e4:88:9d"; }