cryptopb

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

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RSAKeySize_name = map[int32]string{
		0:    "RSA_KEY_SIZE_UNSPECIFIED",
		2048: "RSA_2048",
		3072: "RSA_3072",
		4096: "RSA_4096",
	}
	RSAKeySize_value = map[string]int32{
		"RSA_KEY_SIZE_UNSPECIFIED": 0,
		"RSA_2048":                 2048,
		"RSA_3072":                 3072,
		"RSA_4096":                 4096,
	}
)

Enum value maps for RSAKeySize.

View Source
var (
	EllipticCurve_name = map[int32]string{
		0: "ELLIPTIC_CURVE_UNSPECIFIED",
		1: "EC_P256",
		2: "EC_P384",
		3: "EC_P521",
	}
	EllipticCurve_value = map[string]int32{
		"ELLIPTIC_CURVE_UNSPECIFIED": 0,
		"EC_P256":                    1,
		"EC_P384":                    2,
		"EC_P521":                    3,
	}
)

Enum value maps for EllipticCurve.

View Source
var (
	OKPCurve_name = map[int32]string{
		0: "OKP_CURVE_UNSPECIFIED",
		1: "OKP_ED25519",
	}
	OKPCurve_value = map[string]int32{
		"OKP_CURVE_UNSPECIFIED": 0,
		"OKP_ED25519":           1,
	}
)

Enum value maps for OKPCurve.

View Source
var (
	HashAlgorithm_name = map[int32]string{
		0: "HASH_ALGORITHM_UNSPECIFIED",
		1: "SHA256",
		2: "SHA384",
		3: "SHA512",
	}
	HashAlgorithm_value = map[string]int32{
		"HASH_ALGORITHM_UNSPECIFIED": 0,
		"SHA256":                     1,
		"SHA384":                     2,
		"SHA512":                     3,
	}
)

Enum value maps for HashAlgorithm.

View Source
var (
	KeyManagementAlgorithm_name = map[int32]string{
		0:  "KEY_MANAGEMENT_ALGORITHM_UNSPECIFIED",
		1:  "KEY_MANAGEMENT_ED25519",
		2:  "RSA1_5",
		3:  "RSA_OAEP",
		4:  "RSA_OAEP_256",
		5:  "A128KW",
		6:  "A192KW",
		7:  "A256KW",
		8:  "DIRECT",
		9:  "ECDH_ES",
		10: "ECDH_ES_A128KW",
		11: "ECDH_ES_A192KW",
		12: "ECDH_ES_A256KW",
		13: "A128GCMKW",
		14: "A192GCMKW",
		15: "A256GCMKW",
		16: "PBES2_HS256_A128KW",
		17: "PBES2_HS384_A192KW",
		18: "PBES2_HS512_A256KW",
	}
	KeyManagementAlgorithm_value = map[string]int32{
		"KEY_MANAGEMENT_ALGORITHM_UNSPECIFIED": 0,
		"KEY_MANAGEMENT_ED25519":               1,
		"RSA1_5":                               2,
		"RSA_OAEP":                             3,
		"RSA_OAEP_256":                         4,
		"A128KW":                               5,
		"A192KW":                               6,
		"A256KW":                               7,
		"DIRECT":                               8,
		"ECDH_ES":                              9,
		"ECDH_ES_A128KW":                       10,
		"ECDH_ES_A192KW":                       11,
		"ECDH_ES_A256KW":                       12,
		"A128GCMKW":                            13,
		"A192GCMKW":                            14,
		"A256GCMKW":                            15,
		"PBES2_HS256_A128KW":                   16,
		"PBES2_HS384_A192KW":                   17,
		"PBES2_HS512_A256KW":                   18,
	}
)

Enum value maps for KeyManagementAlgorithm.

View Source
var (
	SignatureAlgorithm_name = map[int32]string{
		0:  "SIGNING_ALGORITHM_UNSPECIFIED",
		1:  "NONE",
		2:  "HS256",
		3:  "HS384",
		4:  "HS512",
		5:  "RS256",
		6:  "RS384",
		7:  "RS512",
		8:  "ES256",
		9:  "ES384",
		10: "ES512",
		11: "PS256",
		12: "PS384",
		13: "PS512",
		14: "EdDSA",
	}
	SignatureAlgorithm_value = map[string]int32{
		"SIGNING_ALGORITHM_UNSPECIFIED": 0,
		"NONE":                          1,
		"HS256":                         2,
		"HS384":                         3,
		"HS512":                         4,
		"RS256":                         5,
		"RS384":                         6,
		"RS512":                         7,
		"ES256":                         8,
		"ES384":                         9,
		"ES512":                         10,
		"PS256":                         11,
		"PS384":                         12,
		"PS512":                         13,
		"EdDSA":                         14,
	}
)

Enum value maps for SignatureAlgorithm.

View Source
var (
	EncryptionAlgorithm_name = map[int32]string{
		0: "ENCRYPTION_ALGORITHM_UNSPECIFIED",
		1: "A128CBC_HS256",
		2: "A192CBC_HS384",
		3: "A256CBC_HS512",
		4: "A128GCM",
		5: "A192GCM",
		6: "A256GCM",
	}
	EncryptionAlgorithm_value = map[string]int32{
		"ENCRYPTION_ALGORITHM_UNSPECIFIED": 0,
		"A128CBC_HS256":                    1,
		"A192CBC_HS384":                    2,
		"A256CBC_HS512":                    3,
		"A128GCM":                          4,
		"A192GCM":                          5,
		"A256GCM":                          6,
	}
)

Enum value maps for EncryptionAlgorithm.

View Source
var (
	EncryptedContent_CompressionAlgorithm_name = map[int32]string{
		0: "COMPRESSION_ALGORITHM_UNSPECIFIED",
		1: "GZIP",
		2: "FLATE",
	}
	EncryptedContent_CompressionAlgorithm_value = map[string]int32{
		"COMPRESSION_ALGORITHM_UNSPECIFIED": 0,
		"GZIP":                              1,
		"FLATE":                             2,
	}
)

Enum value maps for EncryptedContent_CompressionAlgorithm.

View Source
var (
	KeyAlgorithmType_name = map[int32]string{
		0: "KEY_ALGORITHM_TYPE_UNSPECIFIED",
		1: "EC",
		2: "RSA",
		3: "OCTET",
		4: "OKP",
	}
	KeyAlgorithmType_value = map[string]int32{
		"KEY_ALGORITHM_TYPE_UNSPECIFIED": 0,
		"EC":                             1,
		"RSA":                            2,
		"OCTET":                          3,
		"OKP":                            4,
	}
)

Enum value maps for KeyAlgorithmType.

View Source
var (
	Curve_name = map[int32]string{
		0: "CURVE_UNSPECIFIED",
		1: "P256",
		2: "P384",
		3: "P521",
		4: "ED25519",
	}
	Curve_value = map[string]int32{
		"CURVE_UNSPECIFIED": 0,
		"P256":              1,
		"P384":              2,
		"P521":              3,
		"ED25519":           4,
	}
)

Enum value maps for Curve.

View Source
var File_blocky_type_crypto_algorithm_proto protoreflect.FileDescriptor
View Source
var File_blocky_type_crypto_encrypted_content_proto protoreflect.FileDescriptor
View Source
var File_blocky_type_crypto_key_material_proto protoreflect.FileDescriptor
View Source
var File_blocky_type_crypto_signature_proto protoreflect.FileDescriptor

Functions

func EncodeKey

func EncodeKey(key Key, out *KeyMaterial) error

EncodeKey encodes the key material content. The input 'key' can be one of the following types: - ECDSA: *ecdsa.PrivateKey, *ecdsa.PublicKey - RSA: *rsa.PrivateKey, *rsa.PublicKey - Octet: SymmetricKey - OKP: ed25519.PrivateKey, ed25519.PublicKey The encoded key is stored in the 'out' KeyMaterial.

Types

type Curve

type Curve int32

Curve defines the curve used to encode the key material content.

const (
	// Unspecified curve.
	Curve_CURVE_UNSPECIFIED Curve = 0
	// The NIST P-256 elliptic curve.
	Curve_P256 Curve = 1
	// The NIST P-384 elliptic curve.
	Curve_P384 Curve = 2
	// The NIST P-521 elliptic curve.
	Curve_P521 Curve = 3
	// The elliptic curve used by the Edwards-curve Digital Signature Algorithm (EdDSA).
	Curve_ED25519 Curve = 4
)

func (Curve) Descriptor

func (Curve) Descriptor() protoreflect.EnumDescriptor

func (Curve) Enum

func (x Curve) Enum() *Curve

func (Curve) EnumDescriptor deprecated

func (Curve) EnumDescriptor() ([]byte, []int)

Deprecated: Use Curve.Descriptor instead.

func (Curve) Number

func (x Curve) Number() protoreflect.EnumNumber

func (Curve) String

func (x Curve) String() string

func (Curve) Type

func (Curve) Type() protoreflect.EnumType

type EllipticCurve

type EllipticCurve int32

EllipticCurve is an algorithm used to generate and verify JSON Web Keys (JWK) as defined in RFC 7518.

const (
	// Unspecified elliptic curve.
	EllipticCurve_ELLIPTIC_CURVE_UNSPECIFIED EllipticCurve = 0
	// EllipticCurve of type P-256
	EllipticCurve_EC_P256 EllipticCurve = 1
	// EllipticCurve of type P-384
	EllipticCurve_EC_P384 EllipticCurve = 2
	// EllipticCurve of type P-521
	EllipticCurve_EC_P521 EllipticCurve = 3
)

func (EllipticCurve) Descriptor

func (EllipticCurve) Enum

func (x EllipticCurve) Enum() *EllipticCurve

func (EllipticCurve) EnumDescriptor deprecated

func (EllipticCurve) EnumDescriptor() ([]byte, []int)

Deprecated: Use EllipticCurve.Descriptor instead.

func (EllipticCurve) Number

func (EllipticCurve) String

func (x EllipticCurve) String() string

func (EllipticCurve) Type

type EllipticCurveKeyParameters

type EllipticCurveKeyParameters struct {

	// The curve used for the ECDSA key.
	// If not provided by default the curve will be P256.
	Curve EllipticCurve `protobuf:"varint,1,opt,name=curve,proto3,enum=blocky.type.crypto.EllipticCurve" json:"curve,omitempty"`
	// contains filtered or unexported fields
}

Elliptic curve based key parameters.

func (*EllipticCurveKeyParameters) Descriptor deprecated

func (*EllipticCurveKeyParameters) Descriptor() ([]byte, []int)

Deprecated: Use EllipticCurveKeyParameters.ProtoReflect.Descriptor instead.

func (*EllipticCurveKeyParameters) GetCurve

func (*EllipticCurveKeyParameters) ProtoMessage

func (*EllipticCurveKeyParameters) ProtoMessage()

func (*EllipticCurveKeyParameters) ProtoReflect

func (*EllipticCurveKeyParameters) Reset

func (x *EllipticCurveKeyParameters) Reset()

func (*EllipticCurveKeyParameters) String

func (x *EllipticCurveKeyParameters) String() string

type EncryptedContent

type EncryptedContent struct {

	// Header is the header of the encrypted content.
	Header *EncryptedContent_Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// Encrypted Key is the encrypted key.
	EncryptedKey []byte `protobuf:"bytes,2,opt,name=encrypted_key,json=encryptedKey,proto3" json:"encrypted_key,omitempty"`
	// Initialization vector is the initialization vector used to encrypt the content.
	Iv []byte `protobuf:"bytes,3,opt,name=iv,proto3" json:"iv,omitempty"`
	// Cipher text is the encrypted content.
	CipherText []byte `protobuf:"bytes,4,opt,name=cipher_text,json=cipherText,proto3" json:"cipher_text,omitempty"`
	// Authentication tag is the authentication tag used to verify the integrity of the content.
	AuthenticationTag []byte `protobuf:"bytes,5,opt,name=authentication_tag,json=authenticationTag,proto3" json:"authentication_tag,omitempty"`
	// contains filtered or unexported fields
}

EncryptedContent is the content securely encrypted using encryption algorithms.

func (*EncryptedContent) Descriptor deprecated

func (*EncryptedContent) Descriptor() ([]byte, []int)

Deprecated: Use EncryptedContent.ProtoReflect.Descriptor instead.

func (*EncryptedContent) GetAuthenticationTag

func (x *EncryptedContent) GetAuthenticationTag() []byte

func (*EncryptedContent) GetCipherText

func (x *EncryptedContent) GetCipherText() []byte

func (*EncryptedContent) GetEncryptedKey

func (x *EncryptedContent) GetEncryptedKey() []byte

func (*EncryptedContent) GetHeader

func (x *EncryptedContent) GetHeader() *EncryptedContent_Header

func (*EncryptedContent) GetIv

func (x *EncryptedContent) GetIv() []byte

func (*EncryptedContent) ProtoMessage

func (*EncryptedContent) ProtoMessage()

func (*EncryptedContent) ProtoReflect

func (x *EncryptedContent) ProtoReflect() protoreflect.Message

func (*EncryptedContent) Reset

func (x *EncryptedContent) Reset()

func (*EncryptedContent) String

func (x *EncryptedContent) String() string

type EncryptedContent_CompressionAlgorithm

type EncryptedContent_CompressionAlgorithm int32
const (
	// COMPRESSION_ALGORITHM_UNSPECIFIED is the default value.
	EncryptedContent_COMPRESSION_ALGORITHM_UNSPECIFIED EncryptedContent_CompressionAlgorithm = 0
	// GZIP is the gzip compression algorithm.
	EncryptedContent_GZIP EncryptedContent_CompressionAlgorithm = 1
	// FLATE is the flate compression algorithm.
	EncryptedContent_FLATE EncryptedContent_CompressionAlgorithm = 2
)

func (EncryptedContent_CompressionAlgorithm) Descriptor

func (EncryptedContent_CompressionAlgorithm) Enum

func (EncryptedContent_CompressionAlgorithm) EnumDescriptor deprecated

func (EncryptedContent_CompressionAlgorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use EncryptedContent_CompressionAlgorithm.Descriptor instead.

func (EncryptedContent_CompressionAlgorithm) Number

func (EncryptedContent_CompressionAlgorithm) String

func (EncryptedContent_CompressionAlgorithm) Type

type EncryptedContent_Header

type EncryptedContent_Header struct {

	// The globally-unique identifier of the encrypted content.
	Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	// Algorithm used to as the key management algorithm.
	Algorithm KeyManagementAlgorithm `protobuf:"varint,2,opt,name=algorithm,proto3,enum=blocky.type.crypto.KeyManagementAlgorithm" json:"algorithm,omitempty"`
	// Encryption algorithm is the algorithm used to encrypt the content.
	EncryptionAlgorithm EncryptionAlgorithm `` /* 163-byte string literal not displayed */
	// Key identifier is the identifier of the key used to sign the content.
	// This is not a full resource name, but just a key identifier.
	// Possible key material resource references:
	// - `keys/*/materials/*` - For non-cloud keys
	// - `projects/*/keys/*/materials/*` - For cloud keys
	KeyMaterial string `protobuf:"bytes,4,opt,name=key_material,json=keyMaterial,proto3" json:"key_material,omitempty"`
	// Compression algorithm is the algorithm used to compress the content.
	CompressionAlgorithm EncryptedContent_CompressionAlgorithm `` /* 184-byte string literal not displayed */
	// The timestamp when the encrypted content was created.
	IssuedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"`
	// Metadata is the metadata of the signature.
	Metadata map[string]string `` /* 157-byte string literal not displayed */
	// contains filtered or unexported fields
}

Header is the header of the encrypted content.

func (*EncryptedContent_Header) Descriptor deprecated

func (*EncryptedContent_Header) Descriptor() ([]byte, []int)

Deprecated: Use EncryptedContent_Header.ProtoReflect.Descriptor instead.

func (*EncryptedContent_Header) GetAlgorithm

func (*EncryptedContent_Header) GetCompressionAlgorithm

func (*EncryptedContent_Header) GetEncryptionAlgorithm

func (x *EncryptedContent_Header) GetEncryptionAlgorithm() EncryptionAlgorithm

func (*EncryptedContent_Header) GetIssuedAt

func (x *EncryptedContent_Header) GetIssuedAt() *timestamppb.Timestamp

func (*EncryptedContent_Header) GetKeyMaterial

func (x *EncryptedContent_Header) GetKeyMaterial() string

func (*EncryptedContent_Header) GetMetadata

func (x *EncryptedContent_Header) GetMetadata() map[string]string

func (*EncryptedContent_Header) GetUid

func (x *EncryptedContent_Header) GetUid() string

func (*EncryptedContent_Header) ProtoMessage

func (*EncryptedContent_Header) ProtoMessage()

func (*EncryptedContent_Header) ProtoReflect

func (x *EncryptedContent_Header) ProtoReflect() protoreflect.Message

func (*EncryptedContent_Header) Reset

func (x *EncryptedContent_Header) Reset()

func (*EncryptedContent_Header) String

func (x *EncryptedContent_Header) String() string

type EncryptionAlgorithm

type EncryptionAlgorithm int32

EncryptionAlgorithm is an algorithm used to encrypt and decrypt JSON Web Encryption (JWE) as defined in RFC 7518.

const (
	EncryptionAlgorithm_ENCRYPTION_ALGORITHM_UNSPECIFIED EncryptionAlgorithm = 0
	// Defines AES_128_CBC_HMAC_SHA_256 authenticated encryption algorithm.
	EncryptionAlgorithm_A128CBC_HS256 EncryptionAlgorithm = 1
	// Defines AES_192_CBC_HMAC_SHA_384 authenticated encryption algorithm.
	EncryptionAlgorithm_A192CBC_HS384 EncryptionAlgorithm = 2
	// Defines AES_256_CBC_HMAC_SHA_512 authenticated encryption algorithm.
	EncryptionAlgorithm_A256CBC_HS512 EncryptionAlgorithm = 3
	// Defines AES_128_GCM authenticated encryption algorithm.
	EncryptionAlgorithm_A128GCM EncryptionAlgorithm = 4
	// Defines AES_192_GCM authenticated encryption algorithm.
	EncryptionAlgorithm_A192GCM EncryptionAlgorithm = 5
	// Defines AES_256_GCM authenticated encryption algorithm.
	EncryptionAlgorithm_A256GCM EncryptionAlgorithm = 6
)

func (EncryptionAlgorithm) Descriptor

func (EncryptionAlgorithm) Enum

func (EncryptionAlgorithm) EnumDescriptor deprecated

func (EncryptionAlgorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use EncryptionAlgorithm.Descriptor instead.

func (EncryptionAlgorithm) Number

func (EncryptionAlgorithm) String

func (x EncryptionAlgorithm) String() string

func (EncryptionAlgorithm) Type

type HashAlgorithm

type HashAlgorithm int32

HashAlgorithm is an algorithm used to hash content.

const (
	// Unspecified hash algorithm.
	HashAlgorithm_HASH_ALGORITHM_UNSPECIFIED HashAlgorithm = 0
	// HashAlgorithm of type SHA-256
	HashAlgorithm_SHA256 HashAlgorithm = 1
	// HashAlgorithm of type SHA-384
	HashAlgorithm_SHA384 HashAlgorithm = 2
	// HashAlgorithm of type SHA-512
	HashAlgorithm_SHA512 HashAlgorithm = 3
)

func (HashAlgorithm) Descriptor

func (HashAlgorithm) Enum

func (x HashAlgorithm) Enum() *HashAlgorithm

func (HashAlgorithm) EnumDescriptor deprecated

func (HashAlgorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use HashAlgorithm.Descriptor instead.

func (HashAlgorithm) Number

func (HashAlgorithm) String

func (x HashAlgorithm) String() string

func (HashAlgorithm) Type

type Key

type Key any

Key is the type that represents a cryptographic key decoded from a KeyMaterial. Depending on the key type and content it can be: - ECDSA: *ecdsa.PrivateKey, *ecdsa.PublicKey - RSA: *rsa.PrivateKey, *rsa.PublicKey - Octet: SymmetricKey - OKP: ed25519.PrivateKey, ed25519.PublicKey

type KeyAlgorithmParameters

type KeyAlgorithmParameters struct {

	// The parameters of the key algorithm.
	//
	// Types that are assignable to Parameters:
	//
	//	*KeyAlgorithmParameters_RsaKeyParameters
	//	*KeyAlgorithmParameters_EllipticCurveKeyParameters
	//	*KeyAlgorithmParameters_OkpKeyParameters
	//	*KeyAlgorithmParameters_OctetKeyParameters
	Parameters isKeyAlgorithmParameters_Parameters `protobuf_oneof:"parameters"`
	// contains filtered or unexported fields
}

KeyAlgorithmParameters represents the parameters for a key algorithm. The parameters are specific to the key algorithm type.

func (*KeyAlgorithmParameters) Descriptor deprecated

func (*KeyAlgorithmParameters) Descriptor() ([]byte, []int)

Deprecated: Use KeyAlgorithmParameters.ProtoReflect.Descriptor instead.

func (*KeyAlgorithmParameters) GetEllipticCurveKeyParameters

func (x *KeyAlgorithmParameters) GetEllipticCurveKeyParameters() *EllipticCurveKeyParameters

func (*KeyAlgorithmParameters) GetOctetKeyParameters

func (x *KeyAlgorithmParameters) GetOctetKeyParameters() *OctetKeyParameters

func (*KeyAlgorithmParameters) GetOkpKeyParameters

func (x *KeyAlgorithmParameters) GetOkpKeyParameters() *OkpKeyParameters

func (*KeyAlgorithmParameters) GetParameters

func (m *KeyAlgorithmParameters) GetParameters() isKeyAlgorithmParameters_Parameters

func (*KeyAlgorithmParameters) GetRsaKeyParameters

func (x *KeyAlgorithmParameters) GetRsaKeyParameters() *RSAKeyParameters

func (*KeyAlgorithmParameters) ProtoMessage

func (*KeyAlgorithmParameters) ProtoMessage()

func (*KeyAlgorithmParameters) ProtoReflect

func (x *KeyAlgorithmParameters) ProtoReflect() protoreflect.Message

func (*KeyAlgorithmParameters) Reset

func (x *KeyAlgorithmParameters) Reset()

func (*KeyAlgorithmParameters) String

func (x *KeyAlgorithmParameters) String() string

type KeyAlgorithmParameters_EllipticCurveKeyParameters

type KeyAlgorithmParameters_EllipticCurveKeyParameters struct {
	// Parameters of the Elliptic curve key algorithm.
	EllipticCurveKeyParameters *EllipticCurveKeyParameters `protobuf:"bytes,2,opt,name=elliptic_curve_key_parameters,json=ellipticCurveKeyParameters,proto3,oneof"`
}

type KeyAlgorithmParameters_OctetKeyParameters

type KeyAlgorithmParameters_OctetKeyParameters struct {
	// Parameters of the HMAC key algorithm.
	OctetKeyParameters *OctetKeyParameters `protobuf:"bytes,4,opt,name=octet_key_parameters,json=octetKeyParameters,proto3,oneof"`
}

type KeyAlgorithmParameters_OkpKeyParameters

type KeyAlgorithmParameters_OkpKeyParameters struct {
	// Parameters of the Edwards curve key algorithm. (OKP)
	OkpKeyParameters *OkpKeyParameters `protobuf:"bytes,3,opt,name=okp_key_parameters,json=okpKeyParameters,proto3,oneof"`
}

type KeyAlgorithmParameters_RsaKeyParameters

type KeyAlgorithmParameters_RsaKeyParameters struct {
	// Parameters of the RSA key algorithm.
	RsaKeyParameters *RSAKeyParameters `protobuf:"bytes,1,opt,name=rsa_key_parameters,json=rsaKeyParameters,proto3,oneof"`
}

type KeyAlgorithmType

type KeyAlgorithmType int32

KeyAlgorithmType is an algorithm used to generate and verify JSON Web Keys (JWK) as defined in RFC 7518.

const (
	// Unspecified key type.
	KeyAlgorithmType_KEY_ALGORITHM_TYPE_UNSPECIFIED KeyAlgorithmType = 0
	// KeyType of type Elliptic Curve (EC) key
	KeyAlgorithmType_EC KeyAlgorithmType = 1
	// KeyType of type RSA key
	KeyAlgorithmType_RSA KeyAlgorithmType = 2
	// KeyType of type Octet sequence (used to represent symmetric keys)
	KeyAlgorithmType_OCTET KeyAlgorithmType = 3
	// KeyType of type OKP key.
	KeyAlgorithmType_OKP KeyAlgorithmType = 4
)

func (KeyAlgorithmType) Descriptor

func (KeyAlgorithmType) Enum

func (KeyAlgorithmType) EnumDescriptor deprecated

func (KeyAlgorithmType) EnumDescriptor() ([]byte, []int)

Deprecated: Use KeyAlgorithmType.Descriptor instead.

func (KeyAlgorithmType) Number

func (KeyAlgorithmType) String

func (x KeyAlgorithmType) String() string

func (KeyAlgorithmType) Type

type KeyManagementAlgorithm

type KeyManagementAlgorithm int32

KeyManagementType is an algorithm used to encrypt and decrypt content.

const (
	// Unspecified key management type.
	KeyManagementAlgorithm_KEY_MANAGEMENT_ALGORITHM_UNSPECIFIED KeyManagementAlgorithm = 0
	// KeyManagementType of type Edwards-curve Digital Signature Algorithm (EdDSA)
	KeyManagementAlgorithm_KEY_MANAGEMENT_ED25519 KeyManagementAlgorithm = 1
	// KeyManagementType of type RSA-PKCS1v1.5
	KeyManagementAlgorithm_RSA1_5 KeyManagementAlgorithm = 2
	// KeyManagementType of type RSA-OAEP-SHA1
	KeyManagementAlgorithm_RSA_OAEP KeyManagementAlgorithm = 3
	// KeyManagementType of type RSA-OAEP-SHA256
	KeyManagementAlgorithm_RSA_OAEP_256 KeyManagementAlgorithm = 4
	// KeyManagementType of type AES key wrap (128)
	KeyManagementAlgorithm_A128KW KeyManagementAlgorithm = 5
	// KeyManagementType of type AES key wrap (192)
	KeyManagementAlgorithm_A192KW KeyManagementAlgorithm = 6
	// KeyManagementType of type AES key wrap (256)
	KeyManagementAlgorithm_A256KW KeyManagementAlgorithm = 7
	// KeyManagementType of type Direct encryption
	KeyManagementAlgorithm_DIRECT KeyManagementAlgorithm = 8
	// KeyManagementType of type ECDH-ES
	KeyManagementAlgorithm_ECDH_ES KeyManagementAlgorithm = 9
	// KeyManagementType of type ECDH-ES + AES key wrap (128)
	KeyManagementAlgorithm_ECDH_ES_A128KW KeyManagementAlgorithm = 10
	// KeyManagementType of type ECDH-ES + AES key wrap (192)
	KeyManagementAlgorithm_ECDH_ES_A192KW KeyManagementAlgorithm = 11
	// KeyManagementType of type ECDH-ES + AES key wrap (256)
	KeyManagementAlgorithm_ECDH_ES_A256KW KeyManagementAlgorithm = 12
	// KeyManagementType of type AES-GCM key wrap (128)
	KeyManagementAlgorithm_A128GCMKW KeyManagementAlgorithm = 13
	// KeyManagementType of type AES-GCM key wrap (192)
	KeyManagementAlgorithm_A192GCMKW KeyManagementAlgorithm = 14
	// KeyManagementType of type AES-GCM key wrap (256)
	KeyManagementAlgorithm_A256GCMKW KeyManagementAlgorithm = 15
	// KeyManagementType of type PBES2 + HMAC-SHA256 + AES key wrap (128)
	KeyManagementAlgorithm_PBES2_HS256_A128KW KeyManagementAlgorithm = 16
	// KeyManagementType of type PBES2 + HMAC-SHA384 + AES key wrap (192)
	KeyManagementAlgorithm_PBES2_HS384_A192KW KeyManagementAlgorithm = 17
	// KeyManagementType of type PBES2 + HMAC-SHA512 + AES key wrap (256)
	KeyManagementAlgorithm_PBES2_HS512_A256KW KeyManagementAlgorithm = 18
)

func (KeyManagementAlgorithm) Descriptor

func (KeyManagementAlgorithm) Enum

func (KeyManagementAlgorithm) EnumDescriptor deprecated

func (KeyManagementAlgorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use KeyManagementAlgorithm.Descriptor instead.

func (KeyManagementAlgorithm) Number

func (KeyManagementAlgorithm) String

func (x KeyManagementAlgorithm) String() string

func (KeyManagementAlgorithm) Type

type KeyMaterial

type KeyMaterial struct {

	// The key material content type.
	Type KeyAlgorithmType `protobuf:"varint,1,opt,name=type,proto3,enum=blocky.type.crypto.KeyAlgorithmType" json:"type,omitempty"`
	// The elliptic curve used to encode the key material content.
	// This field only applies to Elliptic Curve and OKP key types.
	Curve Curve `protobuf:"varint,2,opt,name=curve,proto3,enum=blocky.type.crypto.Curve" json:"curve,omitempty"`
	// The symmetric key material content.
	K []byte `protobuf:"bytes,3,opt,name=k,proto3" json:"k,omitempty"`
	// Elliptic Curve Public X Coordinate parameter.
	// For ED25519 curve, it is the public key.
	X []byte `protobuf:"bytes,4,opt,name=x,proto3" json:"x,omitempty"`
	// Elliptic Curve Public Y Coordinate parameter.
	Y []byte `protobuf:"bytes,5,opt,name=y,proto3" json:"y,omitempty"`
	// RSA modulus parameter
	N []byte `protobuf:"bytes,6,opt,name=n,proto3" json:"n,omitempty"`
	// Exponent parameter used to generate the RSA key.
	E []byte `protobuf:"bytes,7,opt,name=e,proto3" json:"e,omitempty"`
	// Elliptic Curve Private Key parameter.
	// For ED25519 curve, it is the private key.
	D []byte `protobuf:"bytes,8,opt,name=d,proto3" json:"d,omitempty"`
	// First prime factor of the RSA modulus.
	P []byte `protobuf:"bytes,9,opt,name=p,proto3" json:"p,omitempty"`
	// Second prime factor of the RSA modulus.
	Q []byte `protobuf:"bytes,10,opt,name=q,proto3" json:"q,omitempty"`
	// First Factor Chinese Remainder Theorem (CRT) exponent.
	Dp []byte `protobuf:"bytes,11,opt,name=dp,proto3" json:"dp,omitempty"`
	// Second Factor CRT exponent.
	Dq []byte `protobuf:"bytes,12,opt,name=dq,proto3" json:"dq,omitempty"`
	// First CRT coefficient.
	Qi []byte `protobuf:"bytes,13,opt,name=qi,proto3" json:"qi,omitempty"`
	// contains filtered or unexported fields
}

The content of the cryptographical key.

func (*KeyMaterial) Decode

func (x *KeyMaterial) Decode() (Key, error)

Decode decodes the key material content. If the content represents a public key, only the public key is returned.

func (*KeyMaterial) Descriptor deprecated

func (*KeyMaterial) Descriptor() ([]byte, []int)

Deprecated: Use KeyMaterial.ProtoReflect.Descriptor instead.

func (*KeyMaterial) GetCurve

func (x *KeyMaterial) GetCurve() Curve

func (*KeyMaterial) GetD

func (x *KeyMaterial) GetD() []byte

func (*KeyMaterial) GetDp

func (x *KeyMaterial) GetDp() []byte

func (*KeyMaterial) GetDq

func (x *KeyMaterial) GetDq() []byte

func (*KeyMaterial) GetE

func (x *KeyMaterial) GetE() []byte

func (*KeyMaterial) GetK

func (x *KeyMaterial) GetK() []byte

func (*KeyMaterial) GetN

func (x *KeyMaterial) GetN() []byte

func (*KeyMaterial) GetP

func (x *KeyMaterial) GetP() []byte

func (*KeyMaterial) GetQ

func (x *KeyMaterial) GetQ() []byte

func (*KeyMaterial) GetQi

func (x *KeyMaterial) GetQi() []byte

func (*KeyMaterial) GetType

func (x *KeyMaterial) GetType() KeyAlgorithmType

func (*KeyMaterial) GetX

func (x *KeyMaterial) GetX() []byte

func (*KeyMaterial) GetY

func (x *KeyMaterial) GetY() []byte

func (*KeyMaterial) ProtoMessage

func (*KeyMaterial) ProtoMessage()

func (*KeyMaterial) ProtoReflect

func (x *KeyMaterial) ProtoReflect() protoreflect.Message

func (*KeyMaterial) Reset

func (x *KeyMaterial) Reset()

func (*KeyMaterial) String

func (x *KeyMaterial) String() string

type OKPCurve

type OKPCurve int32

OKPCurve is an algorithm used to generate and verify JSON Web Keys (JWK) as defined in RFC 7518.

const (
	// Unspecified OKP curve.
	OKPCurve_OKP_CURVE_UNSPECIFIED OKPCurve = 0
	// OKPCurve of type Ed25519
	OKPCurve_OKP_ED25519 OKPCurve = 1
)

func (OKPCurve) Descriptor

func (OKPCurve) Descriptor() protoreflect.EnumDescriptor

func (OKPCurve) Enum

func (x OKPCurve) Enum() *OKPCurve

func (OKPCurve) EnumDescriptor deprecated

func (OKPCurve) EnumDescriptor() ([]byte, []int)

Deprecated: Use OKPCurve.Descriptor instead.

func (OKPCurve) Number

func (x OKPCurve) Number() protoreflect.EnumNumber

func (OKPCurve) String

func (x OKPCurve) String() string

func (OKPCurve) Type

type OctetKeyParameters

type OctetKeyParameters struct {

	// The size of the HMAC key in bits.
	// The key size must be at least as long as the hash output length.
	// I.e.: for SHA256 the key size must be at least 256 bits (32 bytes).
	// If not provided the key size will be equal to the hash output length.
	// The maximum key size is 1024 bits (128 bytes).
	// If the key is not multiple of 8 bits, it will be padded with zeros to the
	// nearest multiple of 8 bits.
	// I.e. if the key size is 17 bytes, it will be padded to 24 bytes.
	// If the key size is not provided, the default (256 bits) will be used.
	KeySize int32 `protobuf:"varint,1,opt,name=key_size,json=keySize,proto3" json:"key_size,omitempty"`
	// contains filtered or unexported fields
}

HMAC key parameters.

func (*OctetKeyParameters) Descriptor deprecated

func (*OctetKeyParameters) Descriptor() ([]byte, []int)

Deprecated: Use OctetKeyParameters.ProtoReflect.Descriptor instead.

func (*OctetKeyParameters) GetKeySize

func (x *OctetKeyParameters) GetKeySize() int32

func (*OctetKeyParameters) ProtoMessage

func (*OctetKeyParameters) ProtoMessage()

func (*OctetKeyParameters) ProtoReflect

func (x *OctetKeyParameters) ProtoReflect() protoreflect.Message

func (*OctetKeyParameters) Reset

func (x *OctetKeyParameters) Reset()

func (*OctetKeyParameters) String

func (x *OctetKeyParameters) String() string

type OkpKeyParameters

type OkpKeyParameters struct {

	// The curve used for the OKP key.
	// If not provided by default the curve will be ED25519.
	Curve OKPCurve `protobuf:"varint,1,opt,name=curve,proto3,enum=blocky.type.crypto.OKPCurve" json:"curve,omitempty"`
	// contains filtered or unexported fields
}

Edwards curve based key parameters. (OKP)

func (*OkpKeyParameters) Descriptor deprecated

func (*OkpKeyParameters) Descriptor() ([]byte, []int)

Deprecated: Use OkpKeyParameters.ProtoReflect.Descriptor instead.

func (*OkpKeyParameters) GetCurve

func (x *OkpKeyParameters) GetCurve() OKPCurve

func (*OkpKeyParameters) ProtoMessage

func (*OkpKeyParameters) ProtoMessage()

func (*OkpKeyParameters) ProtoReflect

func (x *OkpKeyParameters) ProtoReflect() protoreflect.Message

func (*OkpKeyParameters) Reset

func (x *OkpKeyParameters) Reset()

func (*OkpKeyParameters) String

func (x *OkpKeyParameters) String() string

type RSAKeyParameters

type RSAKeyParameters struct {

	// The size of the RSA key in bits.
	// If not provided by default the key size will be 2048 bits.
	KeySize RSAKeySize `protobuf:"varint,1,opt,name=key_size,json=keySize,proto3,enum=blocky.type.crypto.RSAKeySize" json:"key_size,omitempty"`
	// contains filtered or unexported fields
}

RSA key parameters.

func (*RSAKeyParameters) Descriptor deprecated

func (*RSAKeyParameters) Descriptor() ([]byte, []int)

Deprecated: Use RSAKeyParameters.ProtoReflect.Descriptor instead.

func (*RSAKeyParameters) GetKeySize

func (x *RSAKeyParameters) GetKeySize() RSAKeySize

func (*RSAKeyParameters) ProtoMessage

func (*RSAKeyParameters) ProtoMessage()

func (*RSAKeyParameters) ProtoReflect

func (x *RSAKeyParameters) ProtoReflect() protoreflect.Message

func (*RSAKeyParameters) Reset

func (x *RSAKeyParameters) Reset()

func (*RSAKeyParameters) String

func (x *RSAKeyParameters) String() string

type RSAKeySize

type RSAKeySize int32

Is the specified RSA key size supported.

const (
	RSAKeySize_RSA_KEY_SIZE_UNSPECIFIED RSAKeySize = 0
	// RSA_2048 is the RSA key size of 2048 bits.
	RSAKeySize_RSA_2048 RSAKeySize = 2048
	// RSA_3072 is the RSA key size of 3072 bits.
	RSAKeySize_RSA_3072 RSAKeySize = 3072
	// RSA_4096 is the RSA key size of 4096 bits.
	RSAKeySize_RSA_4096 RSAKeySize = 4096
)

func (RSAKeySize) Descriptor

func (RSAKeySize) Descriptor() protoreflect.EnumDescriptor

func (RSAKeySize) Enum

func (x RSAKeySize) Enum() *RSAKeySize

func (RSAKeySize) EnumDescriptor deprecated

func (RSAKeySize) EnumDescriptor() ([]byte, []int)

Deprecated: Use RSAKeySize.Descriptor instead.

func (RSAKeySize) Number

func (x RSAKeySize) Number() protoreflect.EnumNumber

func (RSAKeySize) String

func (x RSAKeySize) String() string

func (RSAKeySize) Type

type SignatureAlgorithm

type SignatureAlgorithm int32

SignatureAlgorithm is an algorithm used to sign and verify content.

const (
	// Unspecified algorithm.
	SignatureAlgorithm_SIGNING_ALGORITHM_UNSPECIFIED SignatureAlgorithm = 0
	// Defines No digital signature
	SignatureAlgorithm_NONE SignatureAlgorithm = 1
	// Defines HMAC SHA-256 signing algorithm.
	SignatureAlgorithm_HS256 SignatureAlgorithm = 2
	// Defines HMAC SHA-384 signing algorithm.
	SignatureAlgorithm_HS384 SignatureAlgorithm = 3
	// Defines HMAC SHA-512 signing algorithm.
	SignatureAlgorithm_HS512 SignatureAlgorithm = 4
	// Defines RSA PKCS1 v1.5 signing algorithm.
	SignatureAlgorithm_RS256 SignatureAlgorithm = 5
	// Defines RSA PSS signing algorithm with SHA-384 hash.
	SignatureAlgorithm_RS384 SignatureAlgorithm = 6
	// Defines RSA PSS signing algorithm with SHA-512 hash.
	SignatureAlgorithm_RS512 SignatureAlgorithm = 7
	// Defines Elliptic Curve signing algorithm with P-256 curve SHA-256 hash.
	SignatureAlgorithm_ES256 SignatureAlgorithm = 8
	// Defines Elliptic Curve signing algorithm with P-384 curve SHA-384 hash.
	SignatureAlgorithm_ES384 SignatureAlgorithm = 9
	// Defines Elliptic Curve signing algorithm with P-521 curve SHA-512 hash.
	SignatureAlgorithm_ES512 SignatureAlgorithm = 10
	// Defines RSASSA-PSS signing algorithm with SHA-256 hash.
	SignatureAlgorithm_PS256 SignatureAlgorithm = 11
	// Defines RSASSA-PSS signing algorithm with SHA-384 hash.
	SignatureAlgorithm_PS384 SignatureAlgorithm = 12
	// Defines RSASSA-PSS signing algorithm with SHA-512 hash.
	SignatureAlgorithm_PS512 SignatureAlgorithm = 13
	// Defines EdDSA - Edwards-Curve Digital Signature Algorithm  (Ed25519) signing algorithm.
	SignatureAlgorithm_EdDSA SignatureAlgorithm = 14
)

func (SignatureAlgorithm) Descriptor

func (SignatureAlgorithm) Enum

func (SignatureAlgorithm) EnumDescriptor deprecated

func (SignatureAlgorithm) EnumDescriptor() ([]byte, []int)

Deprecated: Use SignatureAlgorithm.Descriptor instead.

func (SignatureAlgorithm) Number

func (SignatureAlgorithm) String

func (x SignatureAlgorithm) String() string

func (SignatureAlgorithm) Type

type SignedContent

type SignedContent struct {

	// Header is the header of the signature.
	Header *SignedContent_Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// Content is the unchanged content that was signed.
	Content []byte `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	// Signature is the signature of the content.
	Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

SignedContent is a message that represents a Protobuf Web Signature. The resultant signature is in two steps: 1. The Signature message with only the header and content fields are serialized and signed using the key. 2. The resultant signature is appended to the Signature message.

func (*SignedContent) Descriptor deprecated

func (*SignedContent) Descriptor() ([]byte, []int)

Deprecated: Use SignedContent.ProtoReflect.Descriptor instead.

func (*SignedContent) GetContent

func (x *SignedContent) GetContent() []byte

func (*SignedContent) GetHeader

func (x *SignedContent) GetHeader() *SignedContent_Header

func (*SignedContent) GetSignature

func (x *SignedContent) GetSignature() []byte

func (*SignedContent) ProtoMessage

func (*SignedContent) ProtoMessage()

func (*SignedContent) ProtoReflect

func (x *SignedContent) ProtoReflect() protoreflect.Message

func (*SignedContent) Reset

func (x *SignedContent) Reset()

func (*SignedContent) String

func (x *SignedContent) String() string

type SignedContent_Header

type SignedContent_Header struct {

	// The identifier assigned to signed content during signing.
	Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	// Algorithm is the algorithm used to sign the content.
	Algorithm SignatureAlgorithm `protobuf:"varint,2,opt,name=algorithm,json=alg,proto3,enum=blocky.type.crypto.SignatureAlgorithm" json:"algorithm,omitempty"`
	// Key material resource is the material of the key used to sign the content.
	// This is not a full resource name, but just a key identifier.
	// Possible key material resource references:
	// - `keys/*/materials/*` - For non-cloud keys
	// - `projects/*/keys/*/materials/*` - For cloud keys
	KeyMaterial string `protobuf:"bytes,3,opt,name=key_material,json=kid,proto3" json:"key_material,omitempty"`
	// The time at which the signature was issued.
	IssuedAt *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=issued_at,json=iat,proto3" json:"issued_at,omitempty"`
	// Metadata is the metadata of the signature.
	Metadata map[string]string `` /* 167-byte string literal not displayed */
	// contains filtered or unexported fields
}

Header is the header of the signed content..

func (*SignedContent_Header) Descriptor deprecated

func (*SignedContent_Header) Descriptor() ([]byte, []int)

Deprecated: Use SignedContent_Header.ProtoReflect.Descriptor instead.

func (*SignedContent_Header) GetAlgorithm

func (x *SignedContent_Header) GetAlgorithm() SignatureAlgorithm

func (*SignedContent_Header) GetIssuedAt

func (x *SignedContent_Header) GetIssuedAt() *timestamppb.Timestamp

func (*SignedContent_Header) GetKeyMaterial

func (x *SignedContent_Header) GetKeyMaterial() string

func (*SignedContent_Header) GetMetadata

func (x *SignedContent_Header) GetMetadata() map[string]string

func (*SignedContent_Header) GetUid

func (x *SignedContent_Header) GetUid() string

func (*SignedContent_Header) ProtoMessage

func (*SignedContent_Header) ProtoMessage()

func (*SignedContent_Header) ProtoReflect

func (x *SignedContent_Header) ProtoReflect() protoreflect.Message

func (*SignedContent_Header) Reset

func (x *SignedContent_Header) Reset()

func (*SignedContent_Header) String

func (x *SignedContent_Header) String() string

type SymmetricKey

type SymmetricKey []byte

SymmetricKey is a type that represents a symmetric key.

func (SymmetricKey) Equal

func (k SymmetricKey) Equal(x crypto.PrivateKey) bool

Equal reports whether k and x have the same value.

func (SymmetricKey) Public

func (k SymmetricKey) Public() crypto.PublicKey

Public returns the public key corresponding to the opaque, private key.

type SymmetricPublicKey

type SymmetricPublicKey SymmetricKey

SymmetricPublicKey is the alias of the symmetric key type, that implements the crypto.PublicKey interface

interface{
    Equal(x crypto.PublicKey) bool
}

For symmetric keys this value is always equal to the private key. This is only a type used for type assertion.

func (SymmetricPublicKey) Equal

Equal reports whether k and x have the same value.

Jump to

Keyboard shortcuts

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