private IAsyncResult BeginLegacySign(DataHash hash, uint level, AsyncCallback callback, object asyncState)
        {
            PduHeader header    = new PduHeader(_signingServiceCredentials.LoginId);
            ulong     requestId = GenerateRequestId();
            LegacyAggregationRequestPayload payload = level == 0
                ? new LegacyAggregationRequestPayload(requestId, hash)
                : new LegacyAggregationRequestPayload(requestId, hash, level);
            LegacyAggregationPdu pdu = new LegacyAggregationPdu(header, payload, LegacyPdu.GetMacTag(_signingMacAlgorithm, _signingServiceCredentials.LoginKey, header, payload));

            Logger.Debug("Begin legacy sign (request id: {0}){1}{2}", payload.RequestId, Environment.NewLine, pdu);
            return(BeginSignRequest(pdu.Encode(), requestId, hash, level, callback, asyncState));
        }
        private IAsyncResult BeginLegacyExtend(LegacyExtendRequestPayload payload, AsyncCallback callback, object asyncState)
        {
            if (_extendingServiceProtocol == null)
            {
                throw new KsiServiceException("Extending service protocol is missing from service.");
            }

            if (_extendingServiceCredentials == null)
            {
                throw new KsiServiceException("Extending service credentials are missing.");
            }

            PduHeader       header = new PduHeader(_extendingServiceCredentials.LoginId);
            LegacyExtendPdu pdu    = new LegacyExtendPdu(header, payload, LegacyPdu.GetMacTag(_extendingMacAlgorithm, _extendingServiceCredentials.LoginKey, header, payload));

            Logger.Debug("Begin legacy extend. (request id: {0}){1}{2}", payload.RequestId, Environment.NewLine, pdu);
            return(_extendingServiceProtocol.BeginExtend(pdu.Encode(), payload.RequestId, callback, asyncState));
        }