How to use the tink.python.core.key_manager function in tink

To help you get started, we’ve selected a few tink examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / tink / python / aead / aead_key_manager.py View on Github external
def from_cc_registry(type_url: Text) -> key_manager.KeyManager[aead.Aead]:
  return key_manager.KeyManagerCcToPyWrapper(
      cc_key_manager.AeadKeyManager.from_cc_registry(type_url), aead.Aead,
      _AeadCcToPyWrapper)
github google / tink / python / core / __init__.py View on Github external
from __future__ import division
from __future__ import print_function

from tink.python.core import crypto_format as _crypto_format
from tink.python.core import key_manager
from tink.python.core import keyset_handle
from tink.python.core import keyset_reader
from tink.python.core import keyset_writer
from tink.python.core import primitive_set
from tink.python.core import primitive_wrapper
from tink.python.core import registry
from tink.python.core import tink_error


KeyManager = key_manager.KeyManager
PrivateKeyManager = key_manager.PrivateKeyManager

KeysetHandle = keyset_handle.KeysetHandle
new_keyset_handle = KeysetHandle.generate_new
read_keyset_handle = KeysetHandle.read
read_no_secret_keyset_handle = KeysetHandle.read_no_secret

KeysetReader = keyset_reader.KeysetReader
JsonKeysetReader = keyset_reader.JsonKeysetReader
BinaryKeysetReader = keyset_reader.BinaryKeysetReader

KeysetWriter = keyset_writer.KeysetWriter
JsonKeysetWriter = keyset_writer.JsonKeysetWriter
BinaryKeysetWriter = keyset_writer.BinaryKeysetWriter

Registry = registry.Registry
github google / tink / python / streaming_aead / streaming_aead_key_manager.py View on Github external
def from_cc_registry(
    type_url: Text) -> key_manager.KeyManager[streaming_aead.StreamingAead]:
  return key_manager.KeyManagerCcToPyWrapper(
      cc_key_manager.StreamingAeadKeyManager.from_cc_registry(type_url),
      streaming_aead.StreamingAead, _StreamingAeadCcToPyWrapper)
github google / tink / python / core / __init__.py View on Github external
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tink.python.core import crypto_format as _crypto_format
from tink.python.core import key_manager
from tink.python.core import keyset_handle
from tink.python.core import keyset_reader
from tink.python.core import keyset_writer
from tink.python.core import primitive_set
from tink.python.core import primitive_wrapper
from tink.python.core import registry
from tink.python.core import tink_error


KeyManager = key_manager.KeyManager
PrivateKeyManager = key_manager.PrivateKeyManager

KeysetHandle = keyset_handle.KeysetHandle
new_keyset_handle = KeysetHandle.generate_new
read_keyset_handle = KeysetHandle.read
read_no_secret_keyset_handle = KeysetHandle.read_no_secret

KeysetReader = keyset_reader.KeysetReader
JsonKeysetReader = keyset_reader.JsonKeysetReader
BinaryKeysetReader = keyset_reader.BinaryKeysetReader

KeysetWriter = keyset_writer.KeysetWriter
JsonKeysetWriter = keyset_writer.JsonKeysetWriter
BinaryKeysetWriter = keyset_writer.BinaryKeysetWriter

Registry = registry.Registry
github google / tink / python / core / registry.py View on Github external
def public_key_data(cls,
                      private_key_data: tink_pb2.KeyData) -> tink_pb2.KeyData:
    """Generates a new key for the specified key_template."""
    if (private_key_data.key_material_type !=
        tink_pb2.KeyData.ASYMMETRIC_PRIVATE):
      raise tink_error.TinkError('The keyset contains a non-private key')
    key_mgr = cls.key_manager(private_key_data.type_url)
    if not isinstance(key_mgr, km_module.PrivateKeyManager):
      raise tink_error.TinkError(
          'manager for key type {} is not a PrivateKeyManager'
          .format(private_key_data.type_url))
    return key_mgr.public_key_data(private_key_data)