Versions in this module Expand all Collapse all v2 v2.3.4 Sep 30, 2021 Changes in this version + func EncryptSessionKeyWithPassword(sk *SessionKey, password []byte) ([]byte, error) + func GetTime() time.Time + func GetUnixTime() int64 + func IsPGPMessage(data string) bool + func RandomToken(size int) ([]byte, error) + func SetKeyGenerationOffset(offset int64) + func UpdateTime(newTime int64) + type AttachmentProcessor struct + func (ap *AttachmentProcessor) Finish() (*PGPSplitMessage, error) + func (ap *AttachmentProcessor) Process(plainData []byte) + type ClearTextMessage struct + Data []byte + Signature []byte + func NewClearTextMessage(data []byte, signature []byte) *ClearTextMessage + func NewClearTextMessageFromArmored(signedMessage string) (*ClearTextMessage, error) + func (msg *ClearTextMessage) GetArmored() (string, error) + func (msg *ClearTextMessage) GetBinary() []byte + func (msg *ClearTextMessage) GetBinarySignature() []byte + func (msg *ClearTextMessage) GetString() string + type EncryptSplitResult struct + func (res *EncryptSplitResult) Close() (err error) + func (res *EncryptSplitResult) GetKeyPacket() (keyPacket []byte, err error) + func (res *EncryptSplitResult) Write(b []byte) (n int, err error) + type GopenPGP struct + type Identity struct + Email string + Name string + type Key struct + func GenerateKey(name, email string, keyType string, bits int) (*Key, error) + func GenerateRSAKeyWithPrimes(name, email string, bits int, primeone, primetwo, primethree, primefour []byte) (*Key, error) + func NewKey(binKeys []byte) (key *Key, err error) + func NewKeyFromArmored(armored string) (key *Key, err error) + func NewKeyFromArmoredReader(r io.Reader) (key *Key, err error) + func NewKeyFromEntity(entity *openpgp.Entity) (*Key, error) + func NewKeyFromReader(r io.Reader) (key *Key, err error) + func (key *Key) Armor() (string, error) + func (key *Key) ArmorWithCustomHeaders(comment, version string) (string, error) + func (key *Key) CanEncrypt() bool + func (key *Key) CanVerify() bool + func (key *Key) Check() (bool, error) + func (key *Key) ClearPrivateParams() (ok bool) + func (key *Key) Copy() (*Key, error) + func (key *Key) GetArmoredPublicKey() (s string, err error) + func (key *Key) GetArmoredPublicKeyWithCustomHeaders(comment, version string) (string, error) + func (key *Key) GetEntity() *openpgp.Entity + func (key *Key) GetFingerprint() string + func (key *Key) GetHexKeyID() string + func (key *Key) GetKeyID() uint64 + func (key *Key) GetPublicKey() (b []byte, err error) + func (key *Key) GetSHA256Fingerprints() (fingerprints []string) + func (key *Key) IsExpired() bool + func (key *Key) IsLocked() (bool, error) + func (key *Key) IsPrivate() bool + func (key *Key) IsUnlocked() (bool, error) + func (key *Key) Lock(passphrase []byte) (*Key, error) + func (key *Key) PrintFingerprints() + func (key *Key) Serialize() ([]byte, error) + func (key *Key) ToPublic() (publicKey *Key, err error) + func (key *Key) Unlock(passphrase []byte) (*Key, error) + type KeyRing struct + FirstKeyID string + func FilterExpiredKeys(contactKeys []*KeyRing) (filteredKeys []*KeyRing, err error) + func NewKeyRing(key *Key) (*KeyRing, error) + func (keyRing *KeyRing) AddKey(key *Key) error + func (keyRing *KeyRing) CanEncrypt() bool + func (keyRing *KeyRing) CanVerify() bool + func (keyRing *KeyRing) ClearPrivateParams() + func (keyRing *KeyRing) Copy() (*KeyRing, error) + func (keyRing *KeyRing) CountDecryptionEntities() int + func (keyRing *KeyRing) CountEntities() int + func (keyRing *KeyRing) Decrypt(message *PGPMessage, verifyKey *KeyRing, verifyTime int64) (*PlainMessage, error) + func (keyRing *KeyRing) DecryptAttachment(message *PGPSplitMessage) (*PlainMessage, error) + func (keyRing *KeyRing) DecryptMIMEMessage(message *PGPMessage, verifyKey *KeyRing, callbacks MIMECallbacks, ...) + func (keyRing *KeyRing) DecryptSessionKey(keyPacket []byte) (*SessionKey, error) + func (keyRing *KeyRing) DecryptSplitStream(keypacket []byte, dataPacketReader Reader, verifyKeyRing *KeyRing, ...) (plainMessage *PlainMessageReader, err error) + func (keyRing *KeyRing) DecryptStream(message Reader, verifyKeyRing *KeyRing, verifyTime int64) (plainMessage *PlainMessageReader, err error) + func (keyRing *KeyRing) Encrypt(message *PlainMessage, privateKey *KeyRing) (*PGPMessage, error) + func (keyRing *KeyRing) EncryptAttachment(message *PlainMessage, filename string) (*PGPSplitMessage, error) + func (keyRing *KeyRing) EncryptSessionKey(sk *SessionKey) ([]byte, error) + func (keyRing *KeyRing) EncryptSplitStream(dataPacketWriter Writer, plainMessageMetadata *PlainMessageMetadata, ...) (*EncryptSplitResult, error) + func (keyRing *KeyRing) EncryptStream(pgpMessageWriter Writer, plainMessageMetadata *PlainMessageMetadata, ...) (plainMessageWriter WriteCloser, err error) + func (keyRing *KeyRing) EncryptWithCompression(message *PlainMessage, privateKey *KeyRing, ...) (*PGPMessage, error) + func (keyRing *KeyRing) FirstKey() (*KeyRing, error) + func (keyRing *KeyRing) GetIdentities() []*Identity + func (keyRing *KeyRing) GetKey(n int) (*Key, error) + func (keyRing *KeyRing) GetKeyIDs() []uint64 + func (keyRing *KeyRing) GetKeys() []*Key + func (keyRing *KeyRing) NewLowMemoryAttachmentProcessor(estimatedSize int, filename string) (*AttachmentProcessor, error) + func (keyRing *KeyRing) NewManualAttachmentProcessor(estimatedSize int, filename string, dataBuffer []byte) (*ManualAttachmentProcessor, error) + func (keyRing *KeyRing) SignDetached(message *PlainMessage) (*PGPSignature, error) + func (keyRing *KeyRing) SignDetachedEncrypted(message *PlainMessage, encryptionKeyRing *KeyRing) (encryptedSignature *PGPMessage, err error) + func (keyRing *KeyRing) SignDetachedEncryptedStream(message Reader, encryptionKeyRing *KeyRing) (encryptedSignature *PGPMessage, err error) + func (keyRing *KeyRing) SignDetachedStream(message Reader) (*PGPSignature, error) + func (keyRing *KeyRing) VerifyDetached(message *PlainMessage, signature *PGPSignature, verifyTime int64) error + func (keyRing *KeyRing) VerifyDetachedEncrypted(message *PlainMessage, encryptedSignature *PGPMessage, ...) error + func (keyRing *KeyRing) VerifyDetachedEncryptedStream(message Reader, encryptedSignature *PGPMessage, decryptionKeyRing *KeyRing, ...) error + func (keyRing *KeyRing) VerifyDetachedStream(message Reader, signature *PGPSignature, verifyTime int64) error + type MIMECallbacks interface + OnAttachment func(headers string, data []byte) + OnBody func(body string, mimetype string) + OnEncryptedHeaders func(headers string) + OnError func(err error) + OnVerified func(verified int) + type ManualAttachmentProcessor struct + func (ap *ManualAttachmentProcessor) Finish() error + func (ap *ManualAttachmentProcessor) GetDataLength() int + func (ap *ManualAttachmentProcessor) GetKeyPacket() []byte + func (ap *ManualAttachmentProcessor) Process(plainData []byte) error + type PGPMessage struct + Data []byte + func EncryptMessageWithPassword(message *PlainMessage, password []byte) (*PGPMessage, error) + func NewPGPMessage(data []byte) *PGPMessage + func NewPGPMessageFromArmored(armored string) (*PGPMessage, error) + func (msg *PGPMessage) GetArmored() (string, error) + func (msg *PGPMessage) GetArmoredWithCustomHeaders(comment, version string) (string, error) + func (msg *PGPMessage) GetBinary() []byte + func (msg *PGPMessage) GetEncryptionKeyIDs() ([]uint64, bool) + func (msg *PGPMessage) GetHexEncryptionKeyIDs() ([]string, bool) + func (msg *PGPMessage) GetHexSignatureKeyIDs() ([]string, bool) + func (msg *PGPMessage) GetSignatureKeyIDs() ([]uint64, bool) + func (msg *PGPMessage) NewReader() io.Reader + func (msg *PGPMessage) SeparateKeyAndData(estimatedLength, garbageCollector int) (outSplit *PGPSplitMessage, err error) + type PGPSignature struct + Data []byte + func NewPGPSignature(data []byte) *PGPSignature + func NewPGPSignatureFromArmored(armored string) (*PGPSignature, error) + func (msg *PGPSignature) GetArmored() (string, error) + func (msg *PGPSignature) GetBinary() []byte + func (msg *PGPSignature) GetHexSignatureKeyIDs() ([]string, bool) + func (msg *PGPSignature) GetSignatureKeyIDs() ([]uint64, bool) + type PGPSplitMessage struct + DataPacket []byte + KeyPacket []byte + func NewPGPSplitMessage(keyPacket []byte, dataPacket []byte) *PGPSplitMessage + func NewPGPSplitMessageFromArmored(encrypted string) (*PGPSplitMessage, error) + func (msg *PGPSplitMessage) GetArmored() (string, error) + func (msg *PGPSplitMessage) GetBinary() []byte + func (msg *PGPSplitMessage) GetBinaryDataPacket() []byte + func (msg *PGPSplitMessage) GetBinaryKeyPacket() []byte + func (msg *PGPSplitMessage) GetPGPMessage() *PGPMessage + type PlainMessage struct + Data []byte + Filename string + TextType bool + Time uint32 + func DecryptMessageWithPassword(message *PGPMessage, password []byte) (*PlainMessage, error) + func NewPlainMessage(data []byte) *PlainMessage + func NewPlainMessageFromFile(data []byte, filename string, time uint32) *PlainMessage + func NewPlainMessageFromString(text string) *PlainMessage + func (msg *PlainMessage) GetBase64() string + func (msg *PlainMessage) GetBinary() []byte + func (msg *PlainMessage) GetFilename() string + func (msg *PlainMessage) GetString() string + func (msg *PlainMessage) GetTime() uint32 + func (msg *PlainMessage) IsBinary() bool + func (msg *PlainMessage) IsText() bool + func (msg *PlainMessage) NewReader() io.Reader + type PlainMessageMetadata struct + Filename string + IsBinary bool + ModTime int64 + func NewPlainMessageMetadata(isBinary bool, filename string, modTime int64) *PlainMessageMetadata + type PlainMessageReader struct + func (msg *PlainMessageReader) GetMetadata() *PlainMessageMetadata + func (msg *PlainMessageReader) Read(b []byte) (n int, err error) + func (msg *PlainMessageReader) VerifySignature() (err error) + type Reader interface + Read func(b []byte) (n int, err error) + type SessionKey struct + Algo string + Key []byte + func DecryptSessionKeyWithPassword(keyPacket, password []byte) (*SessionKey, error) + func GenerateSessionKey() (*SessionKey, error) + func GenerateSessionKeyAlgo(algo string) (sk *SessionKey, err error) + func NewSessionKeyFromToken(token []byte, algo string) *SessionKey + func (sk *SessionKey) Clear() (ok bool) + func (sk *SessionKey) Decrypt(dataPacket []byte) (*PlainMessage, error) + func (sk *SessionKey) DecryptAndVerify(dataPacket []byte, verifyKeyRing *KeyRing, verifyTime int64) (*PlainMessage, error) + func (sk *SessionKey) DecryptStream(dataPacketReader Reader, verifyKeyRing *KeyRing, verifyTime int64) (plainMessage *PlainMessageReader, err error) + func (sk *SessionKey) Encrypt(message *PlainMessage) ([]byte, error) + func (sk *SessionKey) EncryptAndSign(message *PlainMessage, signKeyRing *KeyRing) ([]byte, error) + func (sk *SessionKey) EncryptStream(dataPacketWriter Writer, plainMessageMetadata *PlainMessageMetadata, ...) (plainMessageWriter WriteCloser, err error) + func (sk *SessionKey) EncryptWithCompression(message *PlainMessage) ([]byte, error) + func (sk *SessionKey) GetBase64Key() string + func (sk *SessionKey) GetCipherFunc() (packet.CipherFunction, error) + type SignatureCollector struct + func (sc *SignatureCollector) Accept(part io.Reader, header textproto.MIMEHeader, ...) (err error) + func (sc SignatureCollector) GetSignature() string + type SignatureVerificationError struct + Message string + Status int + func (e SignatureVerificationError) Error() string + type WriteCloser interface + Close func() (err error) + Write func(b []byte) (n int, err error) + type Writer interface + Write func(b []byte) (n int, err error) Other modules containing this package github.com/yougroupteam/gopenpgp