Beispiel #1
0
        /// <summary>
        /// Decode the input and update this Schedule object.
        /// </summary>
        ///
        /// <param name="input"></param>
        /// <exception cref="EncodingException">For invalid encoding.</exception>
        public void wireDecode(ByteBuffer input)
        {
            // For now, don't use WireFormat and hardcode to use TLV since the encoding
            // doesn't go out over the wire, only into the local SQL database.
            TlvDecoder decoder = new TlvDecoder(input);

            int endOffset = decoder.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.Encrypt_Schedule);

            // Decode the whiteIntervalList.
            ILOG.J2CsMapping.Collections.Collections.Clear(whiteIntervalList_);
            int listEndOffset = decoder
                                .readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.Encrypt_WhiteIntervalList);

            while (decoder.getOffset() < listEndOffset)
            {
                ILOG.J2CsMapping.Collections.Collections.Add(whiteIntervalList_, decodeRepetitiveInterval(decoder));
            }
            decoder.finishNestedTlvs(listEndOffset);

            // Decode the blackIntervalList.
            ILOG.J2CsMapping.Collections.Collections.Clear(blackIntervalList_);
            listEndOffset = decoder
                            .readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.Encrypt_BlackIntervalList);
            while (decoder.getOffset() < listEndOffset)
            {
                ILOG.J2CsMapping.Collections.Collections.Add(blackIntervalList_, decodeRepetitiveInterval(decoder));
            }
            decoder.finishNestedTlvs(listEndOffset);

            decoder.finishNestedTlvs(endOffset);
        }
Beispiel #2
0
        /// <summary>
        /// Decode the input as an NDN-TLV SafeBag and update this object.
        /// </summary>
        ///
        /// <param name="input"></param>
        /// <exception cref="EncodingException">For invalid encoding.</exception>
        public void wireDecode(ByteBuffer input)
        {
            // Decode directly as TLV. We don't support the WireFormat abstraction
            // because this isn't meant to go directly on the wire.
            TlvDecoder decoder   = new TlvDecoder(input);
            int        endOffset = decoder.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.SafeBag_SafeBag);

            // Get the bytes of the certificate and decode.
            int certificateBeginOffset = decoder.getOffset();
            int certificateEndOffset   = decoder.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.Data);

            decoder.seek(certificateEndOffset);
            certificate_ = new Data();
            certificate_.wireDecode(
                decoder.getSlice(certificateBeginOffset, certificateEndOffset),
                net.named_data.jndn.encoding.TlvWireFormat.get());

            privateKeyBag_ = new Blob(
                decoder.readBlobTlv(net.named_data.jndn.encoding.tlv.Tlv.SafeBag_EncryptedKeyBag), true);

            decoder.finishNestedTlvs(endOffset);
        }