INNER CODE UNIT · Go
defaultOps
aead/minisign · private.go:198
defaultOps = 33554432 // libsodium OPS_LIMIT_SENSITIVE
defaultMem = 1073741824 // libsodium MEM_LIMIT_SENSITIVE
)
copy(bytes[6:38], salt[:])
binary.LittleEndian.PutUint64(bytes[38:], defaultOps)
binary.LittleEndian.PutUint64(bytes[46:], defaultMem)
copy(bytes[54:], encryptKey(password, salt[:], defaultOps, defaultMem, privateKeyBytes[:]))
const comment = "untrusted comment: minisign encrypted secret key\n"
encodedBytes := make([]byte, len(comment)+base64.StdEncoding.EncodedLen(len(bytes)))
copy(encodedBytes, []byte(comment))
base64.StdEncoding.Encode(encodedBytes[len(comment):], bytes[:])
return encodedBytes, nil
}
// IsEncrypted reports whether the private key is encrypted.
func IsEncrypted(privateKey []byte) bool {
privateKey = trimUntrustedComment(privateKey)