ic (ots)

Crear funciones

Genera las funciones necesarias para crear claves, firmar y verificar, dada una lista de parámetros (bits=256, largo=28 y tipo='a' en el ejemplo).

from ic_ots import ic_ots
crearclaves, firmar, verificar = uwots_ots (bits=256, largo=28, tipo='a')

La lista de valores bits, largo y tipo disponibles se puede obtener usando...

import ic_valores
lista_bits = ic_valores.bits_disponibles ()
lista_tipos = ic_valores.bits_disponibles ()
lista_largos = ic_valores.largos_disponibles (bits=256, tipo='a')

print (lista_bits)
# ... 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512

print (lista_tipos)
# 's', 'sig', 'a', 'aprox', 'v', 'ver'

print (lista_largos)
# 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, ...

Crear claves

priv, pub = crearclaves ()

Firmar

mensaje = 'abc'
firma, n, sal = firmar (mensaje, priv=priv)

Verificar

v = verificar (mensaje, firma, n, sal, pub=pub)

print (v)
# True

¡Importante!

Todo algoritmo OTS (one-time signature) permite firmar un sólo mensaje por clave. Firmar más de un mensaje con la misma clave rompería la seguridad.

Se debe crear una clave nueva por cada mensaje a firmar.

Parámetros ajustables

Permiten ajustar el tamaño de la firma, el tiempo de verificación o firmado. Se pueden elegir libremente, son independientes del nivel de seguridad.

Valores por defecto

largo = 28
tipo = 'a'

Parámetros de seguridad

Modifican distintos aspectos del nivel de seguridad del algoritmo. Ante la duda, dejar los valores por defecto.

Valores por defecto

bits = 256