parsersa

package module
v0.0.0-...-68b0e5a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2020 License: BSD-3-Clause Imports: 8 Imported by: 8

README

go-parsersa

GoDoc

A simple package to parse RSA key from PEM.

Instalation

go get github.com/HuguesGuilleus/go-parsersa

Usage

package main

import (
	"github.com/HuguesGuilleus/go-parsersa"
)

func main()  {
	k, err := parsersa.PrivFile("key.pem")
	if err != nil {
		fmt.Println("Error when load key:", err)
		return
	}

	// You can use the key
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenPrivKey

func GenPrivKey(file string, size int) (*rsa.PrivateKey, error)

Try to read the file key or generate it if the file don't exist.

func Priv

func Priv(raw []byte) (*rsa.PrivateKey, error)

Parse a RSA private key from a PEM.

func PrivFile

func PrivFile(file string) (*rsa.PrivateKey, error)

Parse a private key from a file.

func Public

func Public(raw []byte) (*rsa.PublicKey, error)

Parse a RSA public key from a PEM.

func PublicFile

func PublicFile(file string) (*rsa.PublicKey, error)

Parse a public key from a file.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL