예제 #1
0
        private static KMSV4Request CreateKMSV4Request(byte[] kmsRequestData)
        {
            KMSV4Request kmsRequest = new KMSV4Request();

            using (MemoryStream stream = new MemoryStream(kmsRequestData))
            {
                using BinaryReader binaryReader = new BinaryReader(stream);
                kmsRequest.BodyLength1          = binaryReader.ReadUInt32();
                kmsRequest.BodyLength2          = binaryReader.ReadUInt32();
                kmsRequest.Request = binaryReader.ReadBytes(kmsRequestData.Length - 8 - 16);
                kmsRequest.Hash    = binaryReader.ReadBytes(16);
            }
            return(kmsRequest);
        }
예제 #2
0
        public byte[] HandleRequest(byte[] request)
        {
            KMSV4Request v4Request = CreateKMSV4Request(request);

            byte[] response = Server.ExecuteKMSServerLogic(v4Request.Request, Logger);

            byte[] hash = GetHashV4(response);

            KMSV4Response kmsv4Response = new KMSV4Response {
                Response = response, Hash = hash
            };

            byte[] responseBytes = CreateKMSV4ResponseBytes(kmsv4Response);
            return(responseBytes);
        }