passforios-gopenpgp/internal/common.go
wussler 54f45d0471
Openpgp security update (V2) (#31)
* Change keyring unlock functionalities

* Add keyring#Lock, keyring#CheckIntegrity, tests

* Update helpers, fix bugs

* Update go.mod with ProtonMail/crypto commit

* Change key management system

* Clear keys from memory + tests

* Create SessionKey with direct encryption for datapackets. Move symmetrickey to password.

* Fix upstream dependencies

* Update module to V2, documentation

* Add linter

* Add v2 folder to .gitignore

* Minor changes to KeyID getters

* Remove old changelog

* Improve docs, remove compilation script
2019-12-27 19:35:43 +01:00

25 lines
719 B
Go

// Package internal contains internal methods and constants.
package internal
import (
"regexp"
"github.com/ProtonMail/gopenpgp/v2/constants"
)
// TrimNewlines removes whitespace from the end of each line of the input
// string.
func TrimNewlines(input string) string {
var re = regexp.MustCompile(`(?m)[ \t]*$`)
return re.ReplaceAllString(input, "")
}
// CreationTimeOffset stores the amount of seconds that a signature may be
// created in the future, to compensate for clock skew.
const CreationTimeOffset = int64(60 * 60 * 24 * 2)
// ArmorHeaders is a map of default armor headers.
var ArmorHeaders = map[string]string{
"Version": constants.ArmorHeaderVersion,
"Comment": constants.ArmorHeaderComment,
}