pkcs8

package
v0.0.0-...-bc8cfc3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pkcs8 implements functions to encrypt, decrypt, parse and to convert EC private keys to PKCS#8 format. However this package is hard forked from https://github.com/youmark/pkcs8 and modified function signatures to match signatures of crypto/x509 and cloudflare/cfssl/helpers to simplify package swapping. License for original package is as follow:

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertECPrivateKeyPEM

func ConvertECPrivateKeyPEM(inPEM []byte) ([]byte, error)

ConvertECPrivateKeyPEM takes an EC Private Key as input and returns PKCS#8 version of it

func ConvertToECPrivateKeyPEM

func ConvertToECPrivateKeyPEM(inPEM []byte) ([]byte, error)

ConvertToECPrivateKeyPEM takes an unencrypted PKCS#8 PEM and converts it to EC Private Key

func DecryptPEMBlock

func DecryptPEMBlock(block *pem.Block, password []byte) ([]byte, error)

DecryptPEMBlock requires PKCS#8 PEM Block and password to decrypt and return unencrypted der []byte

func EncryptPEMBlock

func EncryptPEMBlock(data, password []byte) (*pem.Block, error)

EncryptPEMBlock takes DER-format bytes and password to return an encrypted PKCS#8 PEM-block

func IsEncryptedPEMBlock

func IsEncryptedPEMBlock(block *pem.Block) bool

IsEncryptedPEMBlock checks if a PKCS#8 PEM-block is encrypted or not

func ParsePrivateKeyPEMWithPassword

func ParsePrivateKeyPEMWithPassword(pemBytes, password []byte) (crypto.Signer, error)

ParsePrivateKeyPEMWithPassword parses an encrypted or a decrypted PKCS#8 PEM to crypto.signer

Types

This section is empty.

Jump to

Keyboard shortcuts

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