Esempio n. 1
0
    def read_no_secret(cls,
                       keyset_reader: reader.KeysetReader) -> 'KeysetHandle':
        """Creates a KeysetHandle from a keyset with no secret key material.

    This can be used to load public keysets or envelope encryption keysets.

    Args:
      keyset_reader: A core.KeysetReader object.

    Returns:
      A new KeysetHandle.
    """
        keyset = keyset_reader.read()
        _assert_no_secret_key_material(keyset)
        return cls._create(keyset)
Esempio n. 2
0
 def read(cls, keyset_reader: reader.KeysetReader) -> handle.KeysetHandle:
     """Create a KeysetHandle from a keyset read with keyset_reader."""
     keyset = keyset_reader.read()
     return cls._create(keyset)
Esempio n. 3
0
def read(keyset_reader: reader.KeysetReader) -> handle.KeysetHandle:
    """Create a KeysetHandle from a keyset_reader."""
    keyset = keyset_reader.read()
    return handle.KeysetHandle._create(keyset)  # pylint: disable=protected-access
Esempio n. 4
0
 def read(cls, keyset_reader: reader.KeysetReader,
          master_key_aead: aead.Aead) -> 'KeysetHandle':
     """Tries to create a KeysetHandle from an encrypted keyset."""
     encrypted_keyset = keyset_reader.read_encrypted()
     _assert_enough_encrypted_key_material(encrypted_keyset)
     return cls._create(_decrypt(encrypted_keyset, master_key_aead))