NAME

GPLVote::SignDoc::Client - module for helping create GPLVote SignDoc client software.

SYNOPSIS

use GPLVote::SignDoc::Client;

if (user_sign_is_valid($public_key, $sign, $data)) {
   print "Sign of document is CORRECT\n";
} else {
   print "BAD SIGN!!!\n";
};

my $pub_key_id = calc_pub_key_id($public_key);

my $enc_data = encrypt($public_key, $data);


def get_one_doc {
   my ($doc) = @_;

   push(@global_array, $doc);
};

get_doc('123', \&get_one_doc);
foreach (my $doc (@global_array)) {
   ... process $doc
};

Methods

user_sign_is_valid(base64_plain public_key, base64_plain sign, raw data)

Check signature of data.

public_key - RSA public key for check signature. Encoded in Base64 in one string without special begin/finish strings and without line breaks.

sign - RSA signature. Some format like public_key.

data - signing data for verify signature.

Returning true if signature is valid.

split_base64(base_64 string)

Helping method for separate one long line Base64 on different lines with length 72 chars.

calc_pub_key_id(base64_plain public_key)

Calculate ID of public key.

encrypt(base64_plain public_key, raw data)

Encrypt data over public key.

Returning plain Base64 string with encrypted data.

send_doc(hash document, client_password)

Send document to proxy server.

document - hash with structured document description like:

* type - type of document (for example, "SIGN_REQUEST")

* site - client site identification name (for example, "www.site.com")

* data - encrypted document data like JSON array of strings (for example, encode('["string data1", "string data 2", ...]'))

* template - template for show document data, started from template type line (for example, "LIST\nTitle for data1\nTitle for data 2\n...")

* doc_id - internal client document identificator. Will be present in answered SIGN document.

client_password - client password

get_docs(client_password, get_one_doc function, unixtime from_time)

client_password - client password

function - reference to function with one argument: hash with structured document.

from_time - unix_time of moment after that get all documents

Return 1 if docs present.

BUGS

No known bugs, but this does not mean no bugs exist.

SEE ALSO

http://gplvote.org/

MAINTAINER

Andrey Velikoredchanin <andy@andyhost.ru>

AUTHOR

Andrey Velikoredchanin

COPYRIGHT

GPLVote::SignDoc::Client - module for helping create GPLVote SignDoc client software Copyright (c) 2014, Andrey Velikoredchanin.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

BECAUSE THIS LIBRARY IS LICENSED FREE OF CHARGE, THIS LIBRARY IS BEING PROVIDED "AS IS WITH ALL FAULTS," WITHOUT ANY WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES OF TITLE, NONINFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY, AND EFFORT IS WITH THE YOU. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA