Copyright 2011 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

package packet

import (
	
	
)
LiteralData represents an encrypted file. See RFC 4880, section 5.9.
type LiteralData struct {
	IsBinary bool
	FileName string
	Time     uint32 // Unix epoch time. Either creation time or modification time. 0 means undefined.
	Body     io.Reader
}
ForEyesOnly returns whether the contents of the LiteralData have been marked as especially sensitive.
func ( *LiteralData) () bool {
	return .FileName == "_CONSOLE"
}

func ( *LiteralData) ( io.Reader) ( error) {
	var  [256]byte

	_,  = readFull(, [:2])
	if  != nil {
		return
	}

	.IsBinary = [0] == 'b'
	 := int([1])

	_,  = readFull(, [:])
	if  != nil {
		return
	}

	.FileName = string([:])

	_,  = readFull(, [:4])
	if  != nil {
		return
	}

	.Time = binary.BigEndian.Uint32([:4])
	.Body = 
	return
}
SerializeLiteral serializes a literal data packet to w and returns a WriteCloser to which the data itself can be written and which MUST be closed on completion. The fileName is truncated to 255 bytes.
func ( io.WriteCloser,  bool,  string,  uint32) ( io.WriteCloser,  error) {
	var  [4]byte
	[0] = 't'
	if  {
		[0] = 'b'
	}
	if len() > 255 {
		 = [:255]
	}
	[1] = byte(len())

	,  := serializeStreamHeader(, packetTypeLiteralData)
	if  != nil {
		return
	}

	_,  = .Write([:2])
	if  != nil {
		return
	}
	_,  = .Write([]byte())
	if  != nil {
		return
	}
	binary.BigEndian.PutUint32([:], )
	_,  = .Write([:])
	if  != nil {
		return
	}

	 = 
	return