crypto

package
v0.1.2-0...-0d018a7 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2019, Oath Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyType

type KeyType int

KeyType is the type of private key.

const (
	RSA KeyType
	ECDSA
)

supported key types

func PrivateKeyFromPEMBytes

func PrivateKeyFromPEMBytes(privatePEMBytes []byte) (KeyType, crypto.Signer, error)

PrivateKeyFromPEMBytes returns a private key along with its type from its supplied PEM representation.

type PrivateKeySource

type PrivateKeySource struct {
	// contains filtered or unexported fields
}

PrivateKeySource returns signing keys using the latest Version found in a directory.

func NewPrivateKeySource

func NewPrivateKeySource(dir string, secretName string) *PrivateKeySource

NewPrivateKeySource returns a private key source that uses files in the supplied directory having the supplied prefix. Files in the directory must be named <secret-name>.v<n> to be considered. Sorting is not lexicographic; "v10" sorts higher than "v9"

func (*PrivateKeySource) SigningKey

func (pks *PrivateKeySource) SigningKey() (*SigningKey, error)

SigningKey returns the current signing key.

type SigningKey

type SigningKey struct {
	URI     string        // the URI that identifies the key
	Type    KeyType       // key type
	Value   crypto.Signer // the private key
	Version string        // key Version
}

SigningKey encapsulates a signing key

func (*SigningKey) PEMBytes

func (s *SigningKey) PEMBytes() ([]byte, error)

PEMBytes marshals the signing key to PEM format.

Jump to

Keyboard shortcuts

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