chefcrypto

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: Apache-2.0 Imports: 13 Imported by: 24

README

chefcrypto

Various cryptographic routines for communicating with chef servers for golang programs and libraries. Originally part of goiardi, it's been split out for packaging purposes.

Documentation

See the godocs at https://pkg.go.dev/github.com/ctdk/chefcrypto.

Version

Along with some changes for goiardi 1.0.0, this module got set up with a go.mod file for excellence in go module support. Per the suggestions from the go people on the go modules documentation pages, the chefcrypto module's version has been bumped to v1.0.0 -- not because any incompatible changes were made to support goiardi 1.0.0, but because it's set up for go modules now.

AUTHOR

Jeremy Bingham (jeremy@goiardi.gl)

Copyright 2013-2020, Jeremy Bingham

CODE OF CONDUCT

This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. [code-of-conduct]: http://todogroup.org/opencodeofconduct/#Goiardi/abuse-coc@goiardi.gl

This code of conduct can also be found in CONDUCT.md in this repository.

LICENSE

Like many Chef ecosystem programs, goairdi is licensed under the Apache 2.0 License. See the LICENSE file for details.

The goiardi documentation in the docs directory is licensed under a Creative Commons Attribution 4.0 International (CC-BY 4.0) License.

Chef is copyright (c) 2008-2020 Chef Software (formerly Opscode, Inc.) and its various contributors.

Thanks go out to the fine folks of Chef Software and the Chef community for all their hard work.

Documentation

Overview

Package chefcrypto bundles up crytographic routines for goairdi (and anything else that might need it).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth12HeaderVerify

func Auth12HeaderVerify(pkPem string, hashed, sig []byte) error

Auth12HeaderVerify verifies the newer version 1.2 Chef authentication protocol headers.

func Auth13HeaderVerify added in v0.2.0

func Auth13HeaderVerify(pkPem string, hashed, sig []byte) error

Auth12HeaderVerify verifies the even newer version 1.3 Chef authentication protocol headers

func GenerateRSAKeys

func GenerateRSAKeys() (string, string, error)

GenerateRSAKeys creates a pair of private and public keys for a client.

func GenerateSalt

func GenerateSalt() ([]byte, error)

GenerateSalt makes a new salt for hashing a password.

func HashPasswd

func HashPasswd(passwd string, salt []byte) (string, error)

HashPasswd SHA512 hashes a password string with the provided salt.

func HeaderDecrypt

func HeaderDecrypt(pkPem string, data string) ([]byte, error)

HeaderDecrypt decrypts the encrypted header with the client or user's public key for validating requests. This function is informed by chef-golang's privateDecrypt function.

func PemToPrivateKey added in v1.0.0

func PemToPrivateKey(privPem string) (*rsa.PrivateKey, error)

PemToPrivateKey converts a given pem encoded private key into a proper and usable *rsa.PrivateKey.

func PemToPublicKey added in v1.0.0

func PemToPublicKey(pubPem string) (rsa.PublicKey, error)

PemToPublicKey converts a pem encoded public key to a proper rsa.PublicKey.

func PrivateKeyToString added in v1.0.0

func PrivateKeyToString(priv *rsa.PrivateKey) (string, error)

PrivateKeyToString stringifies a private key.

func PublicKeyToString added in v1.0.0

func PublicKeyToString(pub rsa.PublicKey) (string, error)

PublicKeyToString stringifies a private key.

func SignTextBlock

func SignTextBlock(textBlock string, privKey *rsa.PrivateKey) (string, error)

SignTextBlock signs a block of text using the provided private RSA key. Used by shovey to sign requests that the client can verify.

func ValidatePublicKey

func ValidatePublicKey(publicKey interface{}) (bool, error)

ValidatePublicKey checks that the provided public key is valid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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