util

package
v0.0.0-...-6cdb20f Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

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}

	OIDNamedCurveSecp256k1 = asn1.ObjectIdentifier{1, 3, 132, 0, 10}
	OIDNamedCurveED25519   = asn1.ObjectIdentifier{1, 3, 101, 112}
)

Functions

func AttributeMap

func AttributeMap(attrs ep11.EP11Attributes) map[ep11.Attribute]*pb.AttributeValue

AttributeMap is a map conversion helper function

func AttributeValue

func AttributeValue(v interface{}) *pb.AttributeValue

AttributeValue converts a standard Golang type into an AttributeValue structure

func Convert

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

Convert is a helper function for generating proper Grep11Error structures

func DumpAttributes

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

DumpAttributes converts an Attribute slice into a string of Attributes

func GetAttributeByteValue

func GetAttributeByteValue(val interface{}) ([]byte, error)

GetAttributeByteValue obtains the byte slice equivalent of an attribute struct

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 Pause

func Pause(m chan string, sigs chan os.Signal, message string)

Pause is a helper function that pauses test execution until the user types CTRL-c

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