def attest(ctx, slot, certificate, format):
    """
    Generate a attestation certificate for a key.

    Attestation is used to show that an asymmetric key was generated on the
    YubiKey and therefore doesn't exist outside the device.

    \b
    SLOT        PIV slot with a private key to attest.
    CERTIFICATE File to write attestation certificate to. Use '-' to use stdout.
    """
    controller = ctx.obj['controller']
    try:
        cert = controller.attest(slot)
    except APDUError as e:
        logger.error('Attestation failed', exc_info=e)
        ctx.fail('Attestation failed.')
    certificate.write(cert.public_bytes(encoding=format))
def attest ( ctx , slot , certificate , format ) : controller = ctx . obj [ 'controller' ] try : cert = controller . attest ( slot ) except APDUError as e : logger . error ( 'Attestation failed' , exc_info = e ) ctx . fail ( 'Attestation failed.' ) certificate . write ( cert . public_bytes ( encoding = format ) )
Generate a attestation certificate for a key.

    Attestation is used to show that an asymmetric key was generated on the
    YubiKey and therefore doesn't exist outside the device.

    \b
    SLOT        PIV slot with a private key to attest.
    CERTIFICATE File to write attestation certificate to. Use '-' to use stdout.