util

package
v0.0.0-...-9b092e4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// The following variables are standardized elliptic curve definitions
	OIDNamedCurveP224 = asn1.ObjectIdentifier{1, 3, 132, 0, 33}
	OIDNamedCurveP256 = asn1.ObjectIdentifier{1, 2, 840, 10045, 3, 1, 7}
	OIDNamedCurveP384 = asn1.ObjectIdentifier{1, 3, 132, 0, 34}
	OIDNamedCurveP521 = asn1.ObjectIdentifier{1, 3, 132, 0, 35}
)

Functions

func Convert

func Convert(err error) (bool, *pb.Grep11Error)

Convert returns a formatted GREP11 error message The contents of the error message depend on the source of the error

func DumpAttributes

func DumpAttributes(attrs map[ep11.Attribute][]byte) string

DumpAttributes converts an Attribute slice into a string of Attributes

func GetNamedCurveFromOID

func GetNamedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve

GetNamedCurveFromOID returns an elliptic curve from the specified curve OID

func GetPubKey

func GetPubKey(spki []byte) (crypto.PublicKey, asn1.ObjectIdentifier, error)

GetPubKey converts an ep11 SPKI structure to a golang ecdsa.PublicKey

func GetPubkeyBytesFromSPKI

func GetPubkeyBytesFromSPKI(spki []byte) ([]byte, error)

GetPubkeyBytesFromSPKI extracts a coordinate bit array from the public key in SPKI format

func NewAttribute

func NewAttribute(aType ep11.Attribute, val interface{}) *ep11.AttributeStruct

NewAttribute is a convenience function to make conversions to []C.CK_ATTRIBUTE more convenient

func NewAttributeMap

func NewAttributeMap(attrs ...*ep11.AttributeStruct) map[ep11.Attribute][]byte

NewAttributeMap creates a map of ep11 attributes

func NewAttributeValue

func NewAttributeValue(val interface{}) []byte

NewAttributeValue converts a Golang-based attribute type to a C-based attribute type

Types

type EP11PrivateKey

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

EP11PrivateKey MUST implement crypto.Signer interface so that the crypt/tls package can use an EP11PrivateKey in tls.Certificate: https://golang.org/pkg/crypto/tls/#Certificate

func NewEP11Signer

func NewEP11Signer(cryptoClient pb.CryptoClient, privKeyBlob []byte, spki []byte) (*EP11PrivateKey, error)

NewEP11Signer is used in the creation of a TLS certificate

func (*EP11PrivateKey) Public

func (priv *EP11PrivateKey) Public() crypto.PublicKey

Public is part of the crypto.Signer interface implementation

func (*EP11PrivateKey) Sign

func (priv *EP11PrivateKey) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error)

Sign returns a signature in ASN1 format Reference code crypto/ecdsa.go, func (priv *PrivateKey) Sign() ([]byte, error)

type IAMPerRPCCredentials

type IAMPerRPCCredentials struct {
	Instance    string // Always Required - IBM Cloud HPCS instance ID
	AccessToken string // Required if APIKey nor Endpoint are specified - IBM Cloud IAM access token
	APIKey      string // Required if AccessToken is not specified - IBM Cloud API key
	Endpoint    string // Required if AccessToken is not specified - IBM Cloud IAM endpoint
	// contains filtered or unexported fields
}

IAMPerRPCCredentials type defines the fields required for IBM Cloud IAM authentication This type implements the GRPC PerRPCCredentials interface

func (*IAMPerRPCCredentials) GetRequestMetadata

func (cr *IAMPerRPCCredentials) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

GetRequestMetadata is used by GRPC for authentication

func (*IAMPerRPCCredentials) RequireTransportSecurity

func (cr *IAMPerRPCCredentials) RequireTransportSecurity() bool

RequireTransportSecurity is used by GRPC for authentication

Jump to

Keyboard shortcuts

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