private void WriteChangeCipherSpec() { var writer = Connection.HandshakeOutput.Writer.Alloc(); writer.WriteBigEndian<byte>(1); writer.Commit(); RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.ChangeCipherSpec); }
public AccelaOpenPermitAdapter(OpenPermitContext context) { this.agencyAppId = ConfigurationManager.AppSettings["OP.Accela.App.Id"]; this.agencyAppSecret = ConfigurationManager.AppSettings["OP.Accela.App.Secret"]; if (this.agencyAppId == null || this.agencyAppSecret == null) { throw new ConfigurationErrorsException("OP.Accela.App.Id and OP.Accela.App.Secret are required configuration settings."); } this.context = context; // TODO see if it makes sense to provide a default config, otherwise make sure the AccelaConfig is provided this.config = JsonConvert.DeserializeObject <AgencyConfiguration>(context.Agency.Configuration); // TODO using agency app only, should we change this to citizen app? this.recApi = new RecordHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.inspectionApi = new InspectionHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.documentApi = new DocumentHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.connection = HttpUtility.ParseQueryString(context.Agency.ConnectionString); this.recApi.AgencyId = this.connection["id"]; this.recApi.Environment = this.connection["env"]; this.inspectionApi.AgencyId = this.connection["id"]; this.inspectionApi.Environment = this.connection["env"]; this.documentApi.AgencyId = this.connection["id"]; this.documentApi.Environment = this.connection["env"]; }
public void ApplyEffect(RecordHandler c) { Vector3 position = new Vector3(PositionX, PositionY, PositionZ); Quaternion rotation = new Quaternion(QuaternionX, QuaternionY, QuaternionZ, QuaternionW); c.InstantiateSpellWith(SpellType, CasterId, position, rotation); }
public async Task PerformServerHandshake(X509Certificate serverCertificate, CancellationToken token) { if (_isHandshaking) { throw new InvalidOperationException("Handshake already in progress"); } if (_isAuthenticated) { throw new InvalidOperationException("Renegotiation not supported"); } _recordHandler = new RecordHandler(_securityParameters.MinimumVersion, isClient: false); _handshakeSession = new ServerHandshakeSession(_securityParameters); _isHandshaking = true; var timoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(30)); var cts = CancellationTokenSource.CreateLinkedTokenSource(token, timoutCts.Token); await ReceiveClientHello(cts.Token); await SendServerHello(cts.Token); await ReceiveClientKeyExchangeChangeCipherSpecAndFinished(cts.Token); await SendServerChangeCipherSpec(cts.Token); await SendServerFinished(cts.Token); _isHandshaking = false; _isAuthenticated = true; }
public async Task <ActionResult <List <Author> > > GetAuthors() { var result = await GetAuthorsEff().Run(RecordHandler); RecordHandler.DumpEffect(); return(Ok(result)); }
public IAsyncResult BeginServerHandshake(X509Certificate serverCertificate, AsyncCallback asyncCallback, Object asyncState) { lock (_handshakeLock) { if (_isHandshaking) { throw new InvalidOperationException("Handshake already in progress"); } if (_isAuthenticated) { throw new InvalidOperationException("Renegotiation not supported"); } _recordHandler = new RecordHandler(_securityParameters.MinimumVersion, false); _handshakeSession = new ServerHandshakeSession(_securityParameters); _isHandshaking = true; } AsyncHandshakeResult asyncHandshakeResult = new AsyncHandshakeResult(asyncCallback, asyncState); _recordStream.BeginReceive(new AsyncCallback(ReceiveHandshakeCallback), asyncHandshakeResult); return(asyncHandshakeResult); }
public async Task PerformClientHandshake(CancellationToken token) { if (_isHandshaking) { throw new InvalidOperationException("Handshake already in progress"); } if (_isAuthenticated) { throw new InvalidOperationException("Renegotiation not supported"); } // Create record protocol handler _recordHandler = new RecordHandler(_securityParameters.MinimumVersion, isClient: true); // Create handshake protocol sub handler _handshakeSession = new ClientHandshakeSession(_securityParameters); _isHandshaking = true; await SendClientHello(token); await ReceiveServerHello(token); await SendClientKeyExchange(token); await Task.Delay(100); //await this.ReceiveAlert(token); await SendClientChangeCipherSpec(token); await SendClientFinished(token); await ReceiveChangeCipherSpecAndFinished(token); _isHandshaking = false; _isAuthenticated = true; }
public IAsyncResult BeginClientHandshake(string targetHost, AsyncCallback asyncCallback, Object asyncState) { lock (_handshakeLock) { if (_isHandshaking) { throw new InvalidOperationException("Handshake already in progress"); } if (_isAuthenticated) { throw new InvalidOperationException("Renegotiation not supported"); } _recordHandler = new RecordHandler(_securityParameters.MinimumVersion, true); _handshakeSession = new ClientHandshakeSession(_securityParameters); _isHandshaking = true; } AsyncHandshakeResult asyncHandshakeResult = new AsyncHandshakeResult(asyncCallback, asyncState); ProcessSendHandshakePacket(asyncHandshakeResult); return(asyncHandshakeResult); }
public AccelaOpenPermitAdapter(OpenPermitContext context) { this.agencyAppId = ConfigurationManager.AppSettings["OP.Accela.App.Id"]; this.agencyAppSecret = ConfigurationManager.AppSettings["OP.Accela.App.Secret"]; if (this.agencyAppId == null || this.agencyAppSecret == null) { throw new ConfigurationErrorsException("OP.Accela.App.Id and OP.Accela.App.Secret are required configuration settings."); } this.context = context; // TODO see if it makes sense to provide a default config, otherwise make sure the AccelaConfig is provided this.config = JsonConvert.DeserializeObject<AgencyConfiguration>(context.Agency.Configuration); // TODO using agency app only, should we change this to citizen app? this.recApi = new RecordHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.inspectionApi = new InspectionHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.documentApi = new DocumentHandler(this.agencyAppId, this.agencyAppSecret, ApplicationType.Agency, string.Empty, appConfig); this.connection = HttpUtility.ParseQueryString(context.Agency.ConnectionString); this.recApi.AgencyId = this.connection["id"]; this.recApi.Environment = this.connection["env"]; this.inspectionApi.AgencyId = this.connection["id"]; this.inspectionApi.Environment = this.connection["env"]; this.documentApi.AgencyId = this.connection["id"]; this.documentApi.Environment = this.connection["env"]; }
public async Task PerformClientHandshake(CancellationToken token) { if (this._isHandshaking) { throw new InvalidOperationException("Handshake already in progress"); } if (this._isAuthenticated) { throw new InvalidOperationException("Renegotiation not supported"); } // Create record protocol handler this._recordHandler = new RecordHandler(this._securityParameters.MinimumVersion, isClient: true); // Create handshake protocol sub handler this._handshakeSession = new ClientHandshakeSession(this._securityParameters); this._isHandshaking = true; await this.SendClientHello(token); await this.ReceiveServerHello(token); await this.SendClientKeyExchange(token); await this.ReceiveAlert(token); await this.SendClientChangeCipherSpec(token); await this.SendClientFinished(token); await this.ReceiveChangeCipherSpecAndFinished(token); this._isHandshaking = false; this._isAuthenticated = true; }
private void SendFirstFlightFull() { if (KeyExchange == null) { KeyExchange = _cryptoProvider.KeyExchangeProvider.GetKeyExchange(CipherSuite.KeyExchange, default); } SendSecondFlight(); _state = HandshakeState.WaitingForClientKeyExchange; RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); }
private void SendFirstFlight() { _initialSendDone = true; // Write the client hello _secretSchedule = new SecretSchedules.SecretSchedule12(this); HandshakeHash = new HashBuffer(new Memory <byte>(new byte[HelloSize() + 4])); this.WriteHandshakeFrame(HelloSize(), WriteClientHello, HandshakeType.client_hello); _state = HandshakeState.WaitingForServerHello; RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); }
private void SendFirstFlightAbbreviated(ClientHelloParser clientHello) { WriteServerHello(clientHello.SessionId); _secretSchedule.WriteSessionTicket(); RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); _requiresTicket = false; WriteChangeCipherSpec(); (_storedKey, _writeKey) = _secretSchedule.GenerateKeys(); _secretSchedule.GenerateAndWriteServerVerify(); _state = HandshakeState.WaitingForClientFinishedAbbreviated; RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); }
private void tabControl1_Selected(object sender, TabControlEventArgs e) { //work with settings var settings = WorkWithSettings.GetSettings(); nudDeep.Value = settings.deep; nudWidth.Value = settings.width; nudSpeed.Value = settings.speed; //work with records var players = WorkWithRecords.GetPlayers(); var records = RecordHandler.GetRecords(players); lblRecords.Text = records; }
/// <summary> /// Process one record. /// </summary> public bool ProcessRecord ( [NotNull] IrbisRecord record ) { if (ReferenceEquals(record, null)) { throw new ArgumentNullException("record"); } Context.Record = record; try { Context.Record = record; RecordHandler recordHandler = RecordHandler; if (ReferenceEquals(recordHandler, null)) { throw new Exception(); } ProcessingResult result = recordHandler(Context); if (!string.IsNullOrEmpty(result.Result)) { Context.Accumulated.Append(result.Result); } if (result.Cancel) { return(false); } } catch (Exception ex) { ExceptionEventArgs <Exception> eventArgs = new ExceptionEventArgs <Exception>(ex); EventHandler <ExceptionEventArgs <Exception> > handler = ExceptionHandler; if (!ReferenceEquals(handler, null)) { handler(this, eventArgs); } return(false); } return(true); }
public TLSRecordHandlerTest(string server, int port) { string path = System.Reflection.Assembly.GetAssembly(typeof(TLSRecordHandlerTest)).Location; string directory = Path.GetDirectoryName(path); _server = server; _port = port; _pluginManager = new CipherSuitePluginManager(directory); _cipherSuite = _pluginManager.GetCipherSuite(VERSION, CIPHER_SUITE); if (_cipherSuite != null) { Console.WriteLine("Got cipher suite"); } else { throw new Exception("Error finding cipher suite!"); } _recordHandler = new RecordHandler(VERSION, true); }
private void SecondFlight(ReadableBuffer messageBuffer) { HandshakeHash.HashData(messageBuffer); if (messageBuffer.Length < 4) { throw new NotImplementedException(); } // send second flight var sendSize = KeyExchange.ClientSendSize; _secretSchedule.GenerateMasterSecret(false); this.WriteHandshakeFrame(sendSize, KeyExchange.ClientSendKey, HandshakeType.client_key_exchange); RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); WriteChangeCipherSpec(); (_writeKey, _storedKey) = _secretSchedule.GenerateKeys(); _state = HandshakeState.WaitingForClientFinished; this.WriteHandshakeFrame(_secretSchedule.ClientVerifySize, WriteClientVerify, HandshakeType.finished); RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); _state = HandshakeState.WaitingForChangeCipherSpec; }
private void HandleClientFinished(out bool hasWritten, ReadableBuffer messageBuffer, out Span<byte> span) { span = messageBuffer.ToSpan(); if (_secretSchedule.GenerateAndCompareClientVerify(span)) { _state = HandshakeState.HandshakeCompleted; } if (_requiresTicket) { _secretSchedule.WriteSessionTicket(); hasWritten = true; RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); } WriteChangeCipherSpec(); _writeKey = _storedKey; _secretSchedule.GenerateAndWriteServerVerify(); RecordHandler.WriteRecords(Connection.HandshakeOutput.Reader, RecordType.Handshake); hasWritten = true; _secretSchedule.DisposeStore(); }
public void ApplyEffect(RecordHandler c) { c.SetRotation(Id, new Quaternion(X, Y, Z, W)); }
// Licenses-Animal-Dog-License, Licenses-Animal-Dog-Application // DUB13-00000-00006, DUB13-00000-00005 // Active-LIC_PET, Issued-LIC_PET static void Main(string[] args) { PaginationInfo p = null; string filter = "module=Licenses"; string redirectUrl = "http://*****:*****@accela.com" }); //// Agency Agency ag = a.GetAgency(token, "SOLNDEV-ENG"); Stream sr = a.GetAgencyLogo(token, "SOLNDEV-ENG"); using (FileStream fs = new FileStream(@"C:\Swapnali\TestPurposes\logo.png", FileMode.Create)) { sr.CopyTo(fs); } // Record Contact //ResultDataPaged<Contact> contacts = rec.GetRecordContacts(recordId, token); //List<Contact> cs = new List<Contact> { // new Contact { isPrimary = "N", businessName = "test", // firstName = "Swapnali", lastName = "Dembla", email = "*****@*****.**", // address = new ContactAddress { addressLine1 = "500 San Blvd", city = "San Ramon", state = new State { value = "CA" }, // postalCode = "94566" }, // type = new ContactType { value = "Pet Owner" } }}; //rec.CreateRecordContact(cs, recordId, token); //contacts = rec.GetRecordContacts(recordId, token); //Contact c = ((List<Contact>)contacts.Data)[0]; //c.type.text = null; //c.middleName = "test for Oscar"; //c = rec.UpdateRecordContact(c, recordId, token); //contacts = rec.GetRecordContacts(recordId, token); ////rec.DeleteRecordContact(c.id, rId, token); //contacts = rec.GetRecordContacts(recordId, token); // Address //List<Country> cn = ad.GetCountries(token); //List<State> s = ad.GetStates(token); // Records //Record record = rec.GetRecord(recordId, token); //record.name = "Test Again & Again"; //List<Dictionary<string, string>> cf = rec.GetRecordCustomFields(record.id, token); //record.description = "Test Again & Again"; //record = rec.UpdateRecordDetail(record, token); //record = rec.GetRecord(recordId, token); //records = rec.SearchRecords(token, new RecordFilter { type = new RecordType { category = "Application" }, contact = new Contact { firstName = "Sam" } }, null); //records = rec.GetRecords(token, null); //Record record = new Record { type = new RecordType { id = "Licenses-Animal-Dog-Application" } }; //List<Contact> contactList = new List<Contact> { new Contact { type = new ContactType { value = "Pet Owner" }, firstName = "Swapnali", lastName = "Dembla", email = "*****@*****.**" } }; //Record r1 = rec.CreateRecordInitialize(new Record { type = new RecordType { id = "Licenses-Animal-Dog-Application" } }, token); ////Record r1 = record; //r1.name = "Test Renewal"; //r1.description = "Test Renewal"; //r1 = rec.UpdateRecordDetail(r1, token); //record = rec.GetRecord(r1.id, token); //rec.CreateRecordContact(contactList, r1.id, token); //ResultDataPaged<Contact> cons = rec.GetRecordContacts(r1.id, token); //Contact cn = ((Contact)cons.Data.First()); //cn.lastName = "Dembla"; //cn = rec.UpdateRecordContact(cn, r1.id, token); //List<Dictionary<string, string>> cf = rec.GetRecordCustomFields(r1.id, token); //Dictionary<string, string> temp = cf[1]; //temp["Pet Name"] = "Goof"; ////rec.UpdateRecordCustomFields(r1.id, cf, token); //cf = rec.GetRecordCustomFields(r1.id, token); //cons = rec.GetRecordContacts(r1.id, token); //FileInfo file = new FileInfo(@"C:\Swapnali\TestPurposes\Ducky.jpeg"); //if (file != null) //{ // AttachmentInfo at = new AttachmentInfo { FileType = "image/jpeg", FileName = "Ducky.jpeg", ServiceProviderCode = "BPTMSTR", Description = "Test" }; // at.FileContent = new StreamContent(file.OpenRead()); // rec.CreateRecordDocument(at, r1.id, token, "ooo"); //} //List<Document> docs = rec.GetRecordDocuments(r1.id, token); //record.contacts = new List<Contact> { new Contact { id = "1234", firstName = "Swapnali", lastName = "Dembla", email = "*****@*****.**", type = new ContactType { value = "Pet Owner" } } }; //record = rec.CreateRecordFinalize(new Record { id = "BPTMSTR-14EST-00000-00257", type = new RecordType { id = "Licenses-Animal-Dog-Application" } }, token); //record = rec.CreateRecordFinalize(r1, token); //record = rec.GetRecord(record.id, token); //cons = rec.GetRecordContacts(record.id, token); //cf = rec.GetRecordCustomFields(record.id, token); ////docs = rec.GetRecordDocuments(record.id, token); // Documents //List<DocumentType> d = rec.GetRecordDocumentTypes(recordId, token); //List<Document> docs = rec.GetRecordDocuments(recordId, token); //Stream sr = doc.DownloadDocument("1132", token); //using (FileStream fs = new FileStream(@"C:\Swapnali\TestPurposes\photo.jpeg", FileMode.Create)) //{ // sr.CopyTo(fs); //} //FileInfo file = new FileInfo(@"C:\Swapnali\TestPurposes\Ducky.jpeg"); //if (file != null) //{ // AttachmentInfo at = new AttachmentInfo { FileType = "image/jpeg", FileName = "Ducky.jpeg", ServiceProviderCode = "BPTMSTR", Description = "Test" }; // at.FileContent = new StreamContent(file.OpenRead()); // rec.CreateRecordDocument(at, recordId, token, "ooo"); //} //rec.DeleteRecordDocument("1012", recordId, token); //docs = rec.GetRecordDocuments(recordId, token); // Status //List<Status> s = rec.GetRecordStatuses("Licenses-Animal-Pig-Application", token); //// Workflow //List<WorkflowTask> w2 = rec.GetWorkflowTasks(record.id, token); //WorkflowTask w = rec.GetWorkflowTask(record.id, taskId, token); //UpdateWorkflowTaskRequest uw = new UpdateWorkflowTaskRequest { comment = "testing", status = new Status { value = "In Review" } }; //w = rec.UpdateWorkflowTask("BPTMSTR-DUB14-00000-00059", taskId, uw, token); // Fees //List<RecordFees> fs = rec.GetRecordFees(recordId, token); // Custom Fields //cf = rec.GetRecordCustomFields(recordId, token); //temp = cf[0]; //temp["Pet Name"] = "Toffy"; ////List<Dictionary<string, string>> cfs = new List<Dictionary<string, string>>(); ////Dictionary<string, string> val = new Dictionary<string,string>(); ////val.Add("id", "LIC_DOG_LIC-GENERAL.cINFORMATION"); ////val.Add("Name", "Woofy"); ////cfs.Add(val); //rec.UpdateRecordCustomFields(recordId, cf, token); //cf = rec.GetRecordCustomFields(recordId, token); }
public RecordBuilder(String clientString, RecordHandler recordHandler) { this.clientString = clientString; this.state = State.Initial; this.recordHandler = recordHandler; }
// ReSharper disable once ContextualLoggerProblem public BaseController(ILogger <T> logger, ILogger <RecordHandler> handlerLogger, EffDbContext dbContext, EffectContext effCtx) { Logger = logger; DbContext = dbContext; RecordHandler = new RecordHandler(effCtx, handlerLogger); }
internal Record() { RecordHandler = OnRecording; _recordHandlerHandle = GCHandle.Alloc(RecordHandler); }
private void AddNewRecordIfNeccessary() { var score = Convert.ToInt32(lblRecord.Text); RecordHandler.AddRecord(score); }
public void ApplyEffect(RecordHandler c) { c.SetPosition(Id, new Vector3(X, Y, Z)); }
public void ApplyEffect(RecordHandler c) { c.SetScale(Id, new Vector3(X, Y, Z)); }
public static void Initialize(TestContext testContext) { RecordHandler = new RecordHandler(); }
public void ApplyEffect(RecordHandler c) { c.SetCharacterHp(Id, Hp); }
public void ApplyEffect(RecordHandler c) { c.SetGround(_scale, _timePassedSinceLastShrink); }
public async Task PerformServerHandshake(X509Certificate serverCertificate, CancellationToken token) { if (this._isHandshaking) { throw new InvalidOperationException("Handshake already in progress"); } if (this._isAuthenticated) { throw new InvalidOperationException("Renegotiation not supported"); } this._recordHandler = new RecordHandler(this._securityParameters.MinimumVersion, isClient: false); this._handshakeSession = new ServerHandshakeSession(this._securityParameters, this.logger); this._isHandshaking = true; var timoutCts = new CancellationTokenSource(TimeSpan.FromSeconds(15)); var cts = CancellationTokenSource.CreateLinkedTokenSource(token, timoutCts.Token); await this.ReceiveClientHello(cts.Token); await this.SendServerHello(cts.Token); await this.ReceiveClientKeyExchangeChangeCipherSpecAndFinished(cts.Token); await this.SendServerChangeCipherSpec(cts.Token); await this.SendServerFinished(cts.Token); this._isHandshaking = false; this._isAuthenticated = true; }
public void ApplyEffect(RecordHandler c) { c.InstantiateCharacterWith(ObjId, CharId, UserName); }
public GameModel() { _recordHandler = new RecordHandler(); }