Skip to content
/ koso2 Public

🔑Encrypt message using public key of user with specified GitHub id. Encrypted message can be processed by your Go program.

Notifications You must be signed in to change notification settings

ddddddO/koso2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Koso x Koso

Encrypt message using public key of user with specified GitHub id.
Encrypted message can be processed by your Go program.
Inspired by naisho !

⚠Currently, only RSA is supported.

Usage

Encrypt

package main

import (
	"bytes"
	"fmt"
	"io"
	"os"

	"github.com/ddddddO/koso2"
)

func main() {
	ghUserID := "ddddddO"
	plainMessage := `こんにちは!
Hello!
Halo!
Bonjour!
你好!
안녕하세요!
habari!
`

	callback := func(encrypted string) error { // 'encrypted' is the encrypted plainMessage.
                fmt.Print(encrypted) // For example, we could add processing to send encrypted message to Slack.
		return nil
	}

	if err := koso2.Run(ghUserID, plainMessage, callback); err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}
}

Decrypt

$ openssl pkeyutl -decrypt -in <Encrypted Message File> -inkey ~/.ssh/id_rsa \
    -pkeyopt rsa_padding_mode:oaep -pkeyopt rsa_oaep_md:sha256

Install

Package

$ go get github.com/ddddddO/koso2

CLI

Currently, this CLI only has function of encrypting message with public key of specified GitHub ID and outputting it to standard output.

$ go install github.com/ddddddO/koso2/cmd/koso2@latest

Miscellaneous

Multiple callbacks

err := koso2.Run(ghUserID, plainMessage, callback1, callback2, callback3)

Multiple callbacks concurrently

err := koso2.RunConcurrently(ghUserID, plainMessage, callback1, callback2, callback3)

About

🔑Encrypt message using public key of user with specified GitHub id. Encrypted message can be processed by your Go program.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published