util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

//////////////////////////////////////////////////////////////////////////////

Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

//////////////////////////////////////////////////////////////////////////////

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurveName

func GetCurveName(curve EllipticCurveType) string

func GetEcdsaParamNames

func GetEcdsaParamNames(params *EcdsaParams) (string, string, string)

GetEcdsaParamNames returns the string representations of each parameter in the given EcdsaParams

func GetEncodingName

func GetEncodingName(encoding EcdsaSignatureEncoding) string

func GetHashName

func GetHashName(hashType HashType) string

utilities for converting proto types to strings

func GetKeyInfo

func GetKeyInfo(key *tinkpb.Keyset_Key) (*tinkpb.KeysetInfo_KeyInfo, error)

*

  • @return a KeyInfo-proto from a {@code key} protobuf.

func GetKeysetInfo

func GetKeysetInfo(keyset *tinkpb.Keyset) (*tinkpb.KeysetInfo, error)

*

  • @return a tinkpb.KeysetInfo-proto from a {@code keyset} protobuf.

func NewAesGcmKey

func NewAesGcmKey(version uint32, keyValue []byte) *AesGcmKey

Utilities for AesGcm protos

func NewAesGcmKeyFormat

func NewAesGcmKeyFormat(keySize uint32) *AesGcmKeyFormat

func NewEcdsaKeyFormat

func NewEcdsaKeyFormat(params *EcdsaParams) *EcdsaKeyFormat

func NewEcdsaParams

func NewEcdsaParams(hashType HashType,
	curve EllipticCurveType,
	encoding EcdsaSignatureEncoding) *EcdsaParams

func NewEcdsaPrivateKey

func NewEcdsaPrivateKey(version uint32,
	publicKey *EcdsaPublicKey,
	keyValue []byte) *EcdsaPrivateKey

Utilities for Ecdsa protos

func NewEcdsaPublicKey

func NewEcdsaPublicKey(version uint32,
	params *EcdsaParams,
	x []byte, y []byte) *EcdsaPublicKey

func NewEncryptedKeyset

func NewEncryptedKeyset(encryptedKeySet []byte, info *KeysetInfo) *EncryptedKeyset

func NewHmacKey

func NewHmacKey(params *HmacParams, version uint32, keyValue []byte) *HmacKey

func NewHmacKeyFormat

func NewHmacKeyFormat(params *HmacParams, keySize uint32) *HmacKeyFormat

func NewHmacParams

func NewHmacParams(hashType HashType, tagSize uint32) *HmacParams

Utilities for Hmac Protos

func NewKey

func NewKey(keyData *KeyData,
	status KeyStatusType,
	keyId uint32,
	prefixType OutputPrefixType) *Keyset_Key

func NewKeyData

func NewKeyData(typeUrl string,
	value []byte,
	materialType KeyData_KeyMaterialType) *KeyData

Utilities for Key Protos

func NewKeyset

func NewKeyset(primaryKeyId uint32,
	keys []*Keyset_Key) *Keyset

func ValidateKey

func ValidateKey(key *tinkpb.Keyset_Key) error

*

  • Validates the given key.
  • Returns nil if it is valid; an error otherwise

func ValidateKeyset

func ValidateKeyset(keyset *tinkpb.Keyset) error

*

  • Validates the given key set.
  • Returns nil if it is valid; an error otherwise.

TODO(thaidn): use TypeLiteral to ensure that all keys are of the same primitive.

func ValidateVersion

func ValidateVersion(version uint32, maxExpected uint32) error

ValidateVersion checks whether the given version is valid. The version is valid only if it is the range [0..maxExpected]

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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