module Crypto::Secret
Overview
Interface to hold sensitive information (often cryptographic keys)
Which class should I use?
Crypto::Secret::Key
- Use with small (<= 4096 bytes) keysCrypto::Secret::Large
- Use for decrypted data that may stress mlock limitsCrypto::Secret::Not
- Only use when you're sure the data isn't secret. 0 overhead. No wiping.
Other shards may provide additional Secret
types (sodium.cr)
EXPERIMENTAL
Extended Modules
Direct including types
Defined in:
crypto-secret/bidet.crcrypto-secret/large.cr
crypto-secret/lib.cr
crypto-secret/not.cr
crypto-secret/secret.cr
crypto-secret/stateful.cr
Instance Method Summary
-
#==(other : Secret) : Bool
Timing safe memory compare
-
#==(other : Bytes) : Bool
Timing safe memory compare
- #bytesize : Int32
-
#copy_from(data : Bytes) : Nil
Copies from data
-
#copy_from(data : Crypto::Secret) : Nil
Copies from data
- #dup
- #finalize
-
#hexstring : String
For debugging.
-
#inspect(io : IO) : Nil
Hide internal state to prevent leaking in to logs
-
#move_from(data : Crypto::Secret) : Nil
Copies then wipes data
-
#move_from(data : Bytes) : Nil
Copies then wipes data
-
#noaccess : self
Makes a region inaccessible depending on implementation.
-
#random : self
Fills
Secret
with secure random data -
#readonly : self
Marks a region as read-only depending on implementation.
-
#readonly(& : Bytes -> U) forall U
Temporarily marks a region as readonly depending on implementation and yields
Bytes
-
#readwrite : self
Marks a region as read & write depending on implementation.
-
#readwrite(& : Bytes -> U) forall U
Temporarily marks a region as read & write depending on implementation and yields
Bytes
-
#reset
Wipes data & makes this object available for reuse
-
#wipe(&)
Secret is wiped after exiting the block
-
#wipe
Zeroes data
Macro Summary
Instance Method Detail
Copies then wipes data
Prefer this method over #copy_from
Makes a region inaccessible depending on implementation. It cannot be read or written, but the data are preserved.
Temporarily marks a region as readonly depending on implementation and yields Bytes
Temporarily marks a region as read & write depending on implementation and yields Bytes