mirror of
https://github.com/rwinkhart/rcw.git
synced 2026-08-30 22:06:34 -04:00
Rename all occurrences of "passphrase" to "password"
This commit is contained in:
+13
-16
@@ -14,25 +14,25 @@ import (
|
||||
//
|
||||
// Usage:
|
||||
// rcw init <passwd> : Generates the required sanity check file
|
||||
// rcw <passphrase> : Runs the rcw daemon to decrypt data for three minutes
|
||||
// rcw enc <text> : Encrypts the provided text and outputs the ciphertext to ex-cipher.rcw (attempts to use daemon, falls back to user input for passphrase)
|
||||
// rcw dec : Decrypts ex-cipher.rcw and outputs the plaintext to stdout (attempts to use daemon, falls back to user input for passphrase)
|
||||
// rcw <password> : Runs the rcw daemon to decrypt data for three minutes
|
||||
// rcw enc <text> : Encrypts the provided text and outputs the ciphertext to ex-cipher.rcw (attempts to use daemon, falls back to user input for password)
|
||||
// rcw dec : Decrypts ex-cipher.rcw and outputs the plaintext to stdout (attempts to use daemon, falls back to user input for password)
|
||||
|
||||
// Implementation Notes:
|
||||
// There are two main ways to use the RCW library:
|
||||
//
|
||||
// 1. Daemon mode:
|
||||
// The daemon is started with a passphrase and runs in the background.
|
||||
// The daemon is started with a password and runs in the background.
|
||||
// All encryption/decryption occurs in the daemon.
|
||||
// Avoid using the wrapper.Encrypt/Decrypt functions directly.
|
||||
// Instead, cache the passphrase with the daemon and use the daemon to encrypt/decrypt data.
|
||||
// Instead, cache the password with the daemon and use the daemon to encrypt/decrypt data.
|
||||
//
|
||||
// 2. Standalone mode:
|
||||
// The wrapper.Encrypt/Decrypt functions are used directly.
|
||||
// The passphrase is provided directly to the functions.
|
||||
// The password is provided directly to the functions.
|
||||
//
|
||||
// It is up to the client to perform the sanity check before encrypting data.
|
||||
// This means that when using the daemon to cache the passphrase, the client should
|
||||
// This means that when using the daemon to cache the password, the client should
|
||||
// perform the sanity check before activating the daemon.
|
||||
|
||||
// TODO Tests:
|
||||
@@ -66,7 +66,7 @@ func main() {
|
||||
if daemon.IsOpen() {
|
||||
decBytes = daemon.GetDec(encBytes)
|
||||
} else {
|
||||
decBytes, err = wrappers.DecryptAndZeroizePassphrase(encBytes, front.InputHidden("Enter RCW passphrase:"))
|
||||
decBytes, err = wrappers.DecryptAndZeroizePassword(encBytes, front.InputSecret("Enter RCW password:"))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
@@ -81,8 +81,7 @@ func main() {
|
||||
fmt.Println("Daemon already running")
|
||||
return
|
||||
}
|
||||
err := wrappers.RunSanityCheck(sanityFile, []byte(os.Args[1]))
|
||||
if err != nil {
|
||||
if err := wrappers.RunSanityCheck(sanityFile, []byte(os.Args[1])); err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
@@ -91,8 +90,7 @@ func main() {
|
||||
if os.Args[1] == "init" {
|
||||
// create sanity check file
|
||||
// rcw init <passwd>
|
||||
err := wrappers.GenSanityCheckAndZeroizePassphrase(sanityFile, []byte(os.Args[2]))
|
||||
if err != nil {
|
||||
if err := wrappers.GenSanityCheckAndZeroizePassword(sanityFile, []byte(os.Args[2])); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
return
|
||||
@@ -104,13 +102,12 @@ func main() {
|
||||
if daemon.IsOpen() {
|
||||
encBytes = daemon.GetEncAndZeroizeDecBytes(decBytes)
|
||||
} else {
|
||||
passphrase := front.InputHidden("Enter RCW passphrase: ")
|
||||
err := wrappers.RunSanityCheck(sanityFile, append([]byte{}, passphrase...)) // pass new slice to avoid zeroizing passphrase)
|
||||
if err != nil {
|
||||
password := front.InputSecret("Enter RCW password: ")
|
||||
if err := wrappers.RunSanityCheck(sanityFile, append([]byte{}, password...)); err != nil { // pass new slice to avoid zeroizing password)
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
encBytes = wrappers.EncryptAndZeroizeDecBytesAndPassphrase(decBytes, passphrase)
|
||||
encBytes = wrappers.EncryptAndZeroizeDecBytesAndPassword(decBytes, password)
|
||||
}
|
||||
os.WriteFile(outputFile, encBytes, 0600)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user