當前位置: 首頁>>代碼示例>>Golang>>正文


Golang packet.OpaquePacket類代碼示例

本文整理匯總了Golang中code/google/com/p/go/crypto/openpgp/packet.OpaquePacket的典型用法代碼示例。如果您正苦於以下問題:Golang OpaquePacket類的具體用法?Golang OpaquePacket怎麽用?Golang OpaquePacket使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了OpaquePacket類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewPubkey

func NewPubkey(op *packet.OpaquePacket) (pubkey *Pubkey, err error) {
	var buf bytes.Buffer
	if err = op.Serialize(&buf); err != nil {
		return
	}
	pubkey = &Pubkey{Packet: buf.Bytes()}
	var p packet.Packet
	if p, err = op.Parse(); err != nil {
		return pubkey, pubkey.initUnsupported(op)
	}
	if err = pubkey.setPacket(p); err != nil {
		return
	}
	if pubkey.PublicKey != nil {
		err = pubkey.initV4()
	} else if pubkey.PublicKeyV3 != nil {
		err = pubkey.initV3()
	} else {
		err = ErrInvalidPacketType
	}
	if err != nil {
		pubkey.PublicKey = nil
		pubkey.PublicKeyV3 = nil
		return pubkey, pubkey.initUnsupported(op)
	}
	return
}
開發者ID:kisom,項目名稱:hockeypuck,代碼行數:27,代碼來源:pubkey.go

示例2: NewUserId

func NewUserId(op *packet.OpaquePacket) (uid *UserId, err error) {
	var buf bytes.Buffer
	if err = op.Serialize(&buf); err != nil {
		return
	}
	uid = &UserId{Packet: buf.Bytes()}
	var p packet.Packet
	if p, err = op.Parse(); err != nil {
		return
	}
	if err = uid.setPacket(p); err != nil {
		return
	}
	return uid, uid.init()
}
開發者ID:cmars,項目名稱:hockeypuck,代碼行數:15,代碼來源:userid.go

示例3: NewUserAttribute

func NewUserAttribute(op *packet.OpaquePacket) (uat *UserAttribute, err error) {
	var buf bytes.Buffer
	if err = op.Serialize(&buf); err != nil {
		return
	}
	uat = &UserAttribute{Packet: buf.Bytes()}
	var p packet.Packet
	if p, err = op.Parse(); err != nil {
		return
	}
	if err = uat.setPacket(p); err != nil {
		return
	}
	return uat, uat.init()
}
開發者ID:pruthvirajsinh,項目名稱:prlpks,代碼行數:15,代碼來源:userattribute.go

示例4: NewSubkey

func NewSubkey(op *packet.OpaquePacket) (subkey *Subkey, err error) {
	var buf bytes.Buffer
	if err = op.Serialize(&buf); err != nil {
		return
	}
	subkey = &Subkey{Packet: buf.Bytes()}
	var p packet.Packet
	if p, err = op.Parse(); err != nil {
		return
	}
	if err = subkey.setPacket(p); err != nil {
		return
	}
	if subkey.PublicKey != nil {
		err = subkey.initV4()
	} else if subkey.PublicKeyV3 != nil {
		err = subkey.initV3()
	} else {
		err = ErrInvalidPacketType
	}
	return
}
開發者ID:cmars,項目名稱:hockeypuck,代碼行數:22,代碼來源:subkey.go

示例5: NewSignature

func NewSignature(op *packet.OpaquePacket) (sig *Signature, err error) {
	var buf bytes.Buffer
	if err = op.Serialize(&buf); err != nil {
		return
	}
	sig = &Signature{Packet: buf.Bytes()}
	var p packet.Packet
	if p, err = op.Parse(); err != nil {
		return
	}
	if err = sig.setPacket(p); err != nil {
		return
	}
	if sig.Signature != nil {
		err = sig.initV4()
	} else if sig.SignatureV3 != nil {
		err = sig.initV3()
	} else {
		err = ErrInvalidPacketType
	}
	return
}
開發者ID:pruthvirajsinh,項目名稱:prlpks,代碼行數:22,代碼來源:signature.go

示例6: AppendUnsupported

func (pubkey *Pubkey) AppendUnsupported(opkt *packet.OpaquePacket) {
	var buf bytes.Buffer
	opkt.Serialize(&buf)
	pubkey.Unsupported = append(pubkey.Unsupported, buf.Bytes()...)
}
開發者ID:kisom,項目名稱:hockeypuck,代碼行數:5,代碼來源:pubkey.go


注:本文中的code/google/com/p/go/crypto/openpgp/packet.OpaquePacket類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。