Documentation ¶
Overview ¶
Package util provides helper data types and functions for the GREP11 examples
Index ¶
- Variables
- func AttributeMap(attrs ep11.EP11Attributes) map[ep11.Attribute]*pb.AttributeValue
- func AttributeValue(v interface{}) *pb.AttributeValue
- func Convert(err error) (bool, *pb.Grep11Error)
- func DumpAttributes(attrs map[ep11.Attribute][]byte) string
- func GetAttributeByteValue(val interface{}) ([]byte, error)
- func GetNamedCurveFromOID(oid asn1.ObjectIdentifier) elliptic.Curve
- func GetPubKey(spki []byte) (crypto.PublicKey, asn1.ObjectIdentifier, error)
- func GetPubkeyBytesFromSPKI(spki []byte) ([]byte, error)
- func GetSignMechanismFromOID(oid asn1.ObjectIdentifier) (ep11.Mechanism, error)
- func Pause(m chan string, sigs chan os.Signal, message string)
- func SetMechParm(parm []byte) *pb.Mechanism_ParameterB
- type DH2Int
- type DHParam
- type DHPubKeyASN
- type EP11PrivateKey
- type IAMPerRPCCredentials
Constants ¶
This section is empty.
Variables ¶
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} OIDECPublicKey = asn1.ObjectIdentifier{1, 2, 840, 10045, 2, 1} OIDRSAPublicKey = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 1} OIDDHPublicKey = asn1.ObjectIdentifier{1, 2, 840, 10046, 2} OIDNamedCurveSecp256k1 = asn1.ObjectIdentifier{1, 3, 132, 0, 10} OIDNamedCurveED25519 = asn1.ObjectIdentifier{1, 3, 101, 112} // Supported Dilithium strengths OIDDilithiumHigh = asn1.ObjectIdentifier{1, 3, 6, 1, 4, 1, 2, 267, 1, 6, 5} // Round 2 strength )
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 ¶
DumpAttributes converts an Attribute slice into a string of Attributes
func GetAttributeByteValue ¶
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 GetPubkeyBytesFromSPKI ¶
GetPubkeyBytesFromSPKI extracts a coordinate bit array from the public key in SPKI format
func GetSignMechanismFromOID ¶
func GetSignMechanismFromOID(oid asn1.ObjectIdentifier) (ep11.Mechanism, error)
GetSignMechanismFromOID returns the signing mechanism associated with an object identifier
func SetMechParm ¶
func SetMechParm(parm []byte) *pb.Mechanism_ParameterB
SetMechParm is a helper function that returns a properly formatted mechanism parameter for byte slice parameters
Types ¶
type DHParam ¶
type DHParam struct { Algorithm asn1.ObjectIdentifier PB DH2Int }
DHParam defines the Diffie-Hellman algorithm Identifier structure
type DHPubKeyASN ¶
DHPubKeyASN defines the Diffie-Hellman public key ASN1 encoding structure for GREP11
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 { 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