X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-File-KDBX;a=blobdiff_plain;f=lib%2FFile%2FKDBX%2FKey.pm;h=8fdb0ff9a88b7a43b483ff3f5ba50b1e48b585a1;hp=e7ac888d85b051304038a56daaca94619d91c7c6;hb=1b913e5c8826cae2355b0076ec5701aa3ce63c63;hpb=b30990a507ef30b6f5b6fcb799a2759632c77ff0 diff --git a/lib/File/KDBX/Key.pm b/lib/File/KDBX/Key.pm index e7ac888..8fdb0ff 100644 --- a/lib/File/KDBX/Key.pm +++ b/lib/File/KDBX/Key.pm @@ -128,7 +128,7 @@ Get the raw encryption key. This is calculated based on the primitive(s). The C< challenge-response type keys and is ignored by other types. B The raw key is sensitive information and so is memory-protected while not being accessed. If you -access it, you should L it when you're done. +access it, you should memzero or L it when you're done. =cut @@ -156,7 +156,8 @@ sub _clear_raw_key { $key = $key->hide; -Encrypt the raw key for L. Returns itself to allow method chaining. +Put the raw key in L. Does nothing if the raw key is already in memory +protection. Returns itself to allow method chaining. =cut @@ -170,9 +171,8 @@ sub hide { $key = $key->show; -Decrypt the raw key so it can be accessed. Returns itself to allow method chaining. - -You normally don't need to call this because L calls this implicitly. +Bring the raw key out of memory protection. Does nothing if the raw key is already out of memory protection. +Returns itself to allow method chaining. =cut @@ -183,14 +183,15 @@ sub show { return $self; } -sub is_hidden { !!$SAFE{refaddr($_[0])} } +=method is_hidden + + $bool = $key->is_hidden; + +Get whether or not the key's raw secret is currently in memory protection. -# sub show_scoped { -# my $self = shift; -# require Scope::Guard; -# $self- -# return -# } +=cut + +sub is_hidden { !!$SAFE{refaddr($_[0])} } sub _safe { $SAFE{refaddr($_[0])} } sub _new_safe { $SAFE{refaddr($_[0])} = File::KDBX::Safe->new }