/// <summary>
        /// Begin get additional aggregator configuration data (async)
        /// </summary>
        /// <param name="callback">callback when configuration request is finished</param>
        /// <param name="asyncState">callback async state object</param>
        /// <returns>async result</returns>
        public IAsyncResult BeginGetAggregatorConfig(AsyncCallback callback, object asyncState)
        {
            if (IsLegacyPduVersion)
            {
                throw new KsiServiceException("Aggregator config request is not supported using PDU version v1. Configure the SDK to use PDU v2 format for the given Aggregator.");
            }

            if (_signingServiceProtocol == null)
            {
                throw new KsiServiceException("Signing service protocol is missing from service.");
            }

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

            PduHeader header = new PduHeader(_signingServiceCredentials.LoginId);
            AggregatorConfigRequestPayload payload = new AggregatorConfigRequestPayload();
            AggregationRequestPdu          pdu     = new AggregationRequestPdu(header, payload, _signingMacAlgorithm, _signingServiceCredentials.LoginKey);
            ulong requestId = GenerateRequestId();

            Logger.Debug("Begin get aggregator config (request id: {0}){1}{2}", requestId, Environment.NewLine, pdu);
            return(_signingServiceProtocol.BeginGetAggregatorConfig(pdu.Encode(), requestId, callback, asyncState));
        }
        /// <summary>
        ///     Begin create signature with given data hash (async).
        /// </summary>
        /// <param name="hash">data hash</param>
        /// <param name="level">the level value of the aggregation tree node</param>
        /// <param name="callback">callback when creating signature is finished</param>
        /// <param name="asyncState">callback async state object</param>
        /// <returns>async result</returns>
        public IAsyncResult BeginSign(DataHash hash, uint level, AsyncCallback callback, object asyncState)
        {
            if (hash == null)
            {
                throw new ArgumentNullException(nameof(hash));
            }

            if (hash.Algorithm.HasDeprecatedSinceDate)
            {
                throw new KsiServiceException(string.Format("Hash algorithm {0} is deprecated since {1} and can not be used for signing.", hash.Algorithm.Name,
                                                            hash.Algorithm.DeprecatedSinceDate?.ToString(Constants.DateFormat)));
            }

            if (_signingServiceProtocol == null)
            {
                throw new KsiServiceException("Signing service protocol is missing from service.");
            }

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

            if (IsLegacyPduVersion)
            {
                return(BeginLegacySign(hash, level, callback, asyncState));
            }

            PduHeader header    = new PduHeader(_signingServiceCredentials.LoginId);
            ulong     requestId = GenerateRequestId();
            AggregationRequestPayload payload = level == 0 ? new AggregationRequestPayload(requestId, hash) : new AggregationRequestPayload(requestId, hash, level);
            AggregationRequestPdu     pdu     = new AggregationRequestPdu(header, payload, _signingMacAlgorithm, _signingServiceCredentials.LoginKey);

            Logger.Debug("Begin sign (request id: {0}){1}{2}", payload.RequestId, Environment.NewLine, pdu);
            return(BeginSignRequest(pdu.Encode(), requestId, hash, level, callback, asyncState));
        }