Documentation ¶
Overview ¶
Package s2k implements the various OpenPGP string-to-key transforms as specified in RFC 4800 section 3.7.1.
Deprecated: this package is unmaintained except for security fixes. New applications should consider a more focused, modern alternative to OpenPGP for their specific task. If you are required to interoperate with OpenPGP systems and need a maintained package, consider a community fork. See https://golang.org/issue/44226.
Index ¶
- func HashIdToHash(id byte) (h crypto.Hash, ok bool)
- func HashIdToString(id byte) (name string, ok bool)
- func HashToHashId(h crypto.Hash) (id byte, ok bool)
- func Iterated(out []byte, h hash.Hash, in []byte, salt []byte, count int)
- func Parse(r io.Reader) (f func(out, in []byte), err error)
- func Salted(out []byte, h hash.Hash, in []byte, salt []byte)
- func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error
- func Simple(out []byte, h hash.Hash, in []byte)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashIdToHash ¶
HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP hash id.
func HashIdToString ¶
HashIdToString returns the name of the hash function corresponding to the given OpenPGP hash id.
func HashToHashId ¶
HashIdToHash returns an OpenPGP hash id which corresponds the given Hash.
func Iterated ¶
Iterated writes to out the result of computing the Iterated and Salted S2K function (RFC 4880, section 3.7.1.3) using the given hash, input passphrase, salt and iteration count.
func Parse ¶
Parse reads a binary specification for a string-to-key transformation from r and returns a function which performs that transform.
func Salted ¶
Salted writes to out the result of computing the Salted S2K function (RFC 4880, section 3.7.1.2) using the given hash, input passphrase and salt.
Types ¶
type Config ¶
type Config struct { // Hash is the default hash function to be used. If // nil, SHA1 is used. Hash crypto.Hash // S2KCount is only used for symmetric encryption. It // determines the strength of the passphrase stretching when // the said passphrase is hashed to produce a key. S2KCount // should be between 1024 and 65011712, inclusive. If Config // is nil or S2KCount is 0, the value 65536 used. Not all // values in the above range can be represented. S2KCount will // be rounded up to the next representable value if it cannot // be encoded exactly. When set, it is strongly encrouraged to // use a value that is at least 65536. See RFC 4880 Section // 3.7.1.3. S2KCount int }
Config collects configuration parameters for s2k key-stretching transformatioms. A nil *Config is valid and results in all default values. Currently, Config is used only by the Serialize function in this package.