#!/usr/bin/perl -w 
#
# Zymonic Business Process and Information Management System
# Copyright Zednax Limited 2008 -
# For Authors and Changelog see the subversion history
use strict;

use Zymonic::Script;
use Zymonic::Decryptor::Client;

my $s = Zymonic::Script->new(
    args         => {},
    init_session => '',
    init_auth    => '',
    init_locking => '',
);

main();
exit(0);

sub main
{
    my $zdc = Zymonic::Decryptor::Client->new(
        config => $Zymonic::ZCONFIG{$Zymonic::system},
        db     => $Zymonic::ZCONFIG{$Zymonic::system}->{DB}
    );

    my $response;
    while ( !$response or $response->{old_key_count} - $response->{corrupt_count} > 0 )
    {

        $response = $zdc->call_decryptor(
            {
                messagetype => 'ReEncryptBatch',
            },
        );

    }

}
