dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Rsa-sha1

Threaded View

  1. #1
    Join Date
    Feb 2007
    Posts
    65

    Question Rsa-sha1

    Hi

    I want to implement RSA-SHA1 algorithm in C++, which has to basically a file content using private key, here i have Perl code and looking for a corresponding C++ code, can any one help me?

    PERL Code

    Code:
    # Sign a document with given private key file.
    # The first argument is the document to sign
    # The second argument is the name of the private key file
    sub rsa_sha1_sign {
        my ($to_sign, $pvkFile) = @_;
    
        return write_to_program("openssl sha1 -sign $pvkFile", $to_sign);
    }
    
    # Helper function to write data to a program
    sub write_to_program {
        my ($prog, $data) = @_;
    
        my $pid = open2(*README, *WRITEME, $prog);
        print WRITEME $data;
        close WRITEME;
    
        # slurp entire contents of output into scalar
        my $output;
        local $/ = undef;
        $output = <README>;
        close README;
    
        waitpid($pid, 0);
    
        return $output;
    }
    Last edited by Satsumatable; December 10th, 2009 at 12:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)