Update lint (#44)
* Reduce complexity of SignatureCollector.Accept * Add stylecheck linter, and lint accordingly * Rephrase some comments * godot - Top level comments should end with a dot. * nestif - Reduce nested complexity of code * Review changes Co-authored-by: Aron Wussler <aron@wussler.it>
This commit is contained in:
parent
222decb919
commit
ac8a49c114
15 changed files with 252 additions and 265 deletions
|
|
@ -11,9 +11,9 @@ type ExplicitVerifyMessage struct {
|
|||
SignatureVerificationError *crypto.SignatureVerificationError
|
||||
}
|
||||
|
||||
// DecryptVerifyMessageArmored decrypts an armored PGP message given a private key and its passphrase
|
||||
// and verifies the embedded signature.
|
||||
// Returns the plain data or an error on signature verification failure.
|
||||
// DecryptExplicitVerify decrypts an armored PGP message given a private key
|
||||
// and its passphrase and verifies the embedded signature. Returns the plain
|
||||
// data or an error on signature verification failure.
|
||||
func DecryptExplicitVerify(
|
||||
pgpMessage *crypto.PGPMessage,
|
||||
privateKeyRing, publicKeyRing *crypto.KeyRing,
|
||||
|
|
@ -57,8 +57,9 @@ func DecryptAttachment(keyPacket []byte, dataPacket []byte, keyRing *crypto.KeyR
|
|||
}
|
||||
|
||||
// EncryptAttachment encrypts a file given a plainData and a fileName.
|
||||
// Returns a PGPSplitMessage containing a session key packet and symmetrically encrypted data.
|
||||
// Specifically designed for attachments rather than text messages.
|
||||
// Returns a PGPSplitMessage containing a session key packet and symmetrically
|
||||
// encrypted data. Specifically designed for attachments rather than text
|
||||
// messages.
|
||||
func EncryptAttachment(plainData []byte, fileName string, keyRing *crypto.KeyRing) (*crypto.PGPSplitMessage, error) {
|
||||
plainMessage := crypto.NewPlainMessage(plainData)
|
||||
decrypted, err := keyRing.EncryptAttachment(plainMessage, fileName)
|
||||
|
|
@ -68,8 +69,8 @@ func EncryptAttachment(plainData []byte, fileName string, keyRing *crypto.KeyRin
|
|||
return decrypted, nil
|
||||
}
|
||||
|
||||
// GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys, encoded in JSON, since gomobile can not
|
||||
// handle arrays
|
||||
// GetJsonSHA256Fingerprints returns the SHA256 fingeprints of key and subkeys,
|
||||
// encoded in JSON, since gomobile can not handle arrays.
|
||||
func GetJsonSHA256Fingerprints(publicKey string) ([]byte, error) {
|
||||
key, err := crypto.NewKeyFromArmored(publicKey)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue