예제 #1
0
def register():
    aead.register()
    daead.register()
    hybrid.register()
    cc_tink_config.register()
    _register_key_managers()
    _register_primitive_wrappers()
예제 #2
0
def register():
    """Registers all Hybrid key managers and wrapper in the Python Registry."""
    cc_tink_config.register()

    decrypt_type_url = (
        'type.googleapis.com/google.crypto.tink.EciesAeadHkdfPrivateKey')
    decrypt_key_manager = core.PrivateKeyManagerCcToPyWrapper(
        cc_key_manager.HybridDecryptKeyManager.from_cc_registry(
            decrypt_type_url), _hybrid_decrypt.HybridDecrypt,
        _HybridDecryptCcToPyWrapper)
    core.Registry.register_key_manager(decrypt_key_manager,
                                       new_key_allowed=True)
    core.Registry.register_primitive_wrapper(
        _hybrid_wrapper.HybridDecryptWrapper())

    encrypt_type_url = (
        'type.googleapis.com/google.crypto.tink.EciesAeadHkdfPublicKey')
    encrypt_key_manager = core.KeyManagerCcToPyWrapper(
        cc_key_manager.HybridEncryptKeyManager.from_cc_registry(
            encrypt_type_url), _hybrid_encrypt.HybridEncrypt,
        _HybridEncryptCcToPyWrapper)
    core.Registry.register_key_manager(encrypt_key_manager,
                                       new_key_allowed=True)
    core.Registry.register_primitive_wrapper(
        _hybrid_wrapper.HybridEncryptWrapper())
def register():
    """Registers all signature key managers in the Python registry."""
    cc_tink_config.register()

    for key_type_identifier in (
            'EcdsaPrivateKey',
            'Ed25519PrivateKey',
            'RsaSsaPssPrivateKey',
            'RsaSsaPkcs1PrivateKey',
    ):
        type_url = 'type.googleapis.com/google.crypto.tink.' + key_type_identifier
        key_manager = core.PrivateKeyManagerCcToPyWrapper(
            cc_key_manager.PublicKeySignKeyManager.from_cc_registry(type_url),
            _public_key_sign.PublicKeySign, _PublicKeySignCcToPyWrapper)
        core.Registry.register_key_manager(key_manager, new_key_allowed=True)

    for key_type_identifier in (
            'EcdsaPublicKey',
            'Ed25519PublicKey',
            'RsaSsaPssPublicKey',
            'RsaSsaPkcs1PublicKey',
    ):
        type_url = 'type.googleapis.com/google.crypto.tink.' + key_type_identifier
        key_manager = core.KeyManagerCcToPyWrapper(
            cc_key_manager.PublicKeyVerifyKeyManager.from_cc_registry(
                type_url), _public_key_verify.PublicKeyVerify,
            _PublicKeyVerifyCcToPyWrapper)
        core.Registry.register_key_manager(key_manager, new_key_allowed=True)

    core.Registry.register_primitive_wrapper(
        _signature_wrapper.PublicKeySignWrapper())
    core.Registry.register_primitive_wrapper(
        _signature_wrapper.PublicKeyVerifyWrapper())
예제 #4
0
def register():
  cc_tink_config.register()

  for key_type_identifier in ('HmacKey', 'AesCmacKey',):
    type_url = 'type.googleapis.com/google.crypto.tink.' + key_type_identifier
    key_manager = core.KeyManagerCcToPyWrapper(
        cc_key_manager.MacKeyManager.from_cc_registry(type_url), _mac.Mac,
        _MacCcToPyWrapper)
    core.Registry.register_key_manager(key_manager, new_key_allowed=True)
  core.Registry.register_primitive_wrapper(_mac_wrapper.MacWrapper())
예제 #5
0
def register():
  """Registers all Hybrid key managers and wrapper in the Python Registry."""
  cc_tink_config.register()

  type_url = 'type.googleapis.com/google.crypto.tink.AesSivKey'
  key_manager = core.KeyManagerCcToPyWrapper(
      cc_key_manager.DeterministicAeadKeyManager.from_cc_registry(type_url),
      _deterministic_aead.DeterministicAead, _DeterministicAeadCcToPyWrapper)
  core.Registry.register_key_manager(key_manager, new_key_allowed=True)
  core.Registry.register_primitive_wrapper(
      _deterministic_aead_wrapper.DeterministicAeadWrapper())
예제 #6
0
def register() -> None:
    """Registers all AEAD key managers and AEAD wrapper in the Registry."""
    cc_tink_config.register()
    for ident in (
            'AesCtrHmacAeadKey',
            'AesGcmKey',
            'AesGcmSivKey',
            'AesEaxKey',
            'XChaCha20Poly1305Key',
            'KmsAeadKey',
            'KmsEnvelopeAeadKey',
    ):
        type_url = 'type.googleapis.com/google.crypto.tink.{}'.format(ident)
        key_manager = core.KeyManagerCcToPyWrapper(
            cc_key_manager.AeadKeyManager.from_cc_registry(type_url),
            _aead.Aead, _AeadCcToPyWrapper)
        core.Registry.register_key_manager(key_manager, new_key_allowed=True)
    core.Registry.register_primitive_wrapper(_aead_wrapper.AeadWrapper())
예제 #7
0
def setUpModule():
    cc_tink_config.register()
예제 #8
0
파일: tink_config.py 프로젝트: yaziza/tink
def register():
    cc_tink_config.register()
    _register_key_managers()
    _register_primitive_wrappers()