本文整理汇总了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
}
示例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()
}
示例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()
}
示例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
}
示例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
}
示例6: AppendUnsupported
func (pubkey *Pubkey) AppendUnsupported(opkt *packet.OpaquePacket) {
var buf bytes.Buffer
opkt.Serialize(&buf)
pubkey.Unsupported = append(pubkey.Unsupported, buf.Bytes()...)
}