attributes

package
v0.0.0-...-82629c9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TCertEncAttributesBase is the base ASN1 object identifier for attributes.
	// When generating an extension to include the attribute an index will be
	// appended to this Object Identifier.
	TCertEncAttributesBase = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6}

	// TCertAttributesHeaders is the ASN1 object identifier of attributes header.
	TCertAttributesHeaders = asn1.ObjectIdentifier{1, 2, 3, 4, 5, 6, 9}

	//HeaderAttributeName is the name used to derivate the K used to encrypt/decrypt the header.
	HeaderAttributeName = "attributeHeader"
)

Functions

func BuildAttributesHeader

func BuildAttributesHeader(attributesHeader map[string]int) ([]byte, error)

BuildAttributesHeader builds a header attribute from a map of attribute names and positions.

func CreateAttributesMetadata

func CreateAttributesMetadata(raw []byte, metadata []byte, preK0 []byte, attributeKeys []string) ([]byte, error)

CreateAttributesMetadata create the AttributesMetadata from the original metadata

func CreateAttributesMetadataFromCert

func CreateAttributesMetadataFromCert(cert *x509.Certificate, metadata []byte, preK0 []byte, attributeKeys []string) ([]byte, error)

CreateAttributesMetadataFromCert creates the AttributesMetadata from the original metadata and certificate "cert".

func CreateAttributesMetadataObjectFromCert

func CreateAttributesMetadataObjectFromCert(cert *x509.Certificate, metadata []byte, preK0 []byte, attributeKeys []string) *pb.AttributesMetadata

CreateAttributesMetadataObjectFromCert creates an AttributesMetadata object from certificate "cert", metadata and the attributes keys.

func DecryptAttributeValue

func DecryptAttributeValue(attributeKey []byte, encryptedValue []byte) ([]byte, error)

DecryptAttributeValue decrypts "encryptedValue" using "attributeKey" and return the decrypted value.

func EncryptAttributeValue

func EncryptAttributeValue(attributeKey []byte, attributeValue []byte) ([]byte, error)

EncryptAttributeValue encrypts "attributeValue" using "attributeKey"

func EncryptAttributeValuePK0

func EncryptAttributeValuePK0(preK0 []byte, attributeName string, attributeValue []byte) ([]byte, error)

EncryptAttributeValuePK0 encrypts "attributeValue" using a key derived from preK0.

func GetAttributesMetadata

func GetAttributesMetadata(metadata []byte) (*pb.AttributesMetadata, error)

GetAttributesMetadata object from the original metadata "metadata".

func GetKForAttribute

func GetKForAttribute(attributeName string, preK0 []byte, cert *x509.Certificate) ([]byte, error)

GetKForAttribute derives the K for the attribute "attributeName" and returns the key

func GetValueForAttribute

func GetValueForAttribute(attributeName string, preK0 []byte, cert *x509.Certificate) ([]byte, error)

GetValueForAttribute derives the K for the attribute "attributeName" and returns the value

func ParseAttributesHeader

func ParseAttributesHeader(header string) (map[string]int, error)

ParseAttributesHeader parses a string and returns a map with the attributes.

func ReadAttributeHeader

func ReadAttributeHeader(tcert *x509.Certificate, headerKey []byte) (map[string]int, bool, error)

ReadAttributeHeader read the header of the attributes.

func ReadTCertAttribute

func ReadTCertAttribute(tcert *x509.Certificate, attributeName string, headerKey []byte) ([]byte, bool, error)

ReadTCertAttribute read the attribute with name "attributeName" and returns the value and a boolean indicating if the returned value is encrypted or not.

func ReadTCertAttributeByPosition

func ReadTCertAttributeByPosition(tcert *x509.Certificate, position int) ([]byte, error)

ReadTCertAttributeByPosition read the attribute stored in the position "position" of the tcert.

Types

This section is empty.

Directories

Path Synopsis
Package protos is a generated protocol buffer package.
Package protos is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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