• Stars
    star
    29
  • Rank 860,175 (Top 17 %)
  • Language
    Go
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

CLI program to encrypt/decrypt andOTP files

go-andotp

CLI program to encrypt/decrypt andOTP files.

Installation

Linux

Download:

  • x86_64 Intel or AMD 64-Bit CPU
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-linux-x86_64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"
  • arm64 Arm-based 64-Bit CPU (i.e. in Raspberry Pi)
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-linux-arm64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"

To determine your OS version, run getconf LONG_BIT or uname -m at the command line.

macOS

Download:

  • x86_64 Intel 64-bit
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-macos-x86_64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"
  • arm64 Apple silicon 64-bit
    curl -L "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-macos-arm64" \
         -o "go-andotp" && \
    chmod +x "go-andotp"

To determine your OS version, run uname -m at the command line.

Windows

Download:

  • x86_64 Intel or AMD 64-Bit CPU
    Invoke-WebRequest -Uri "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-windows-x86_64.exe" -OutFile "go-andotp.exe"
  • arm64 Arm-based 64-Bit CPU
    Invoke-WebRequest -Uri "https://github.com/RijulGulati/go-andotp/releases/latest/download/go-andotp-windows-arm64.exe" -OutFile "go-andotp.exe"

To determine your OS version, run echo %PROCESSOR_ARCHITECTURE% at the command line.

Go
go install github.com/grijul/go-andotp

Usage

Usage: go-andotp -i <INPUT_FILE> {-e|-d} [-o <OUT_FILE>] [-p PASSWORD]

  -d    Decrypt file
  -e    Encrypt file.
  -i string
        Input File
  -o string
        Output File. If no file is provided, output is printed to STDOUT
  -p string
        Encryption Password. This option can be skipped to get password prompt.

Examples

  • Encrypt JSON file (Password is asked after hitting Enter. Password is not echoed)
go-andotp -e -i file.json -o file.json.aes
  • Encrypt JSON file (Password is entered through CLI)
go-andotp -e -i file.json -o file.json.aes -p testpass
  • Decrypt JSON file
go-andotp -d -i file.aes.json -o file.json
  • Decrypt JSON file and print json to console
go-andotp -d -i file.aes.json

Using go-andotp as library

go-andotp can be used as library as well. It implements Encrypt() and Decrypt() functions to encrypt/decrypt text (respectively). It's documentation is available at: https://pkg.go.dev/github.com/grijul/go-andotp/andotp

Example usage:

import "github.com/grijul/go-andotp/andotp"

func main() {
    andotp.Encrypt(...)
    andotp.Decrypt(...)
}

Build

Compile go-andotp on your computer:

go build -o go-andotp main.go

To compile go-andotp for another platform please set the GOARCH and GOOS environmental variables. Example:

GOOS=windows GOARCH=amd64 go build -o go-andotp.exe main.go

To compile go-andotp for Windows, macOS and Linux you can use the script build.sh:

bash build.sh

More help: https://go.dev/doc/install/source#environment

License

MIT