Involved Source Files
Package s2k implements the various OpenPGP string-to-key transforms as
specified in RFC 4800 section 3.7.1.
Package-Level Type Names (only one, which is exported)
/* sort exporteds by: | */
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.
Hash is the default hash function to be used. If
nil, SHA1 is used.
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.
(*T) encodedCount() uint8(*T) hash() crypto.Hash
func Serialize(w io.Writer, key []byte, rand io.Reader, passphrase []byte, c *Config) error
Package-Level Functions (total 10, in which 8 are exported)
HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP
hash id.
HashIdToString returns the name of the hash function corresponding to the
given OpenPGP hash id.
HashIdToHash returns an OpenPGP hash id which corresponds the given Hash.
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.
Parse reads a binary specification for a string-to-key transformation from r
and returns a function which performs that transform.
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.
Serialize salts and stretches the given passphrase and writes the
resulting key into key. It also serializes an S2K descriptor to
w. The key stretching can be configured with c, which may be
nil. In that case, sensible defaults will be used.
Simple writes to out the result of computing the Simple S2K function (RFC
4880, section 3.7.1.1) using the given hash and input passphrase.
decodeCount returns the s2k mode 3 iterative "count" corresponding to
the encoded octet c.
encodeCount converts an iterative "count" in the range 1024 to
65011712, inclusive, to an encoded count. The return value is the
octet that is actually stored in the GPG file. encodeCount panics
if i is not in the above range (encodedCount above takes care to
pass i in the correct range). See RFC 4880 Section 3.7.7.1.
Package-Level Variables (total 2, neither is exported)
hashToHashIdMapping contains pairs relating OpenPGP's hash identifier with
Go's crypto.Hash type. See RFC 4880, section 9.4.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.