protected override void DecodeDataBytes(byte[] data) { if (data.Length < 2 || (data.Length % 2) != 0) { throw new AlertException(AlertDescription.IllegalParameter, "SignatureAlgorithms extension data length invalid: " + data.Length); } int len = (data[0] << 8) | data[1]; if (len != data.Length - 2) { throw new AlertException(AlertDescription.IllegalParameter, "SignatureAlgorithms extension data invalid"); } for (int i = 0; i < len / 2; i++) { var tuple = new SignatureAndHashAlgorithm { HashAlgorithm = (HashAlgorithmType)(data[2 + i * 2]), SignatureAlgorithm = (SignatureAlgorithmType)data[2 + i * 2 + 1] }; SupportedSignatureAlgorithms.Add(tuple); } }
public HelloSignatureAlgorithmsExtension(SignatureAndHashAlgorithm[] supported) : base(HelloExtensionType.SignatureAlgorithms) { this.SupportedSignatureAlgorithms = new List<SignatureAndHashAlgorithm>(supported); }