in reply to Perl Crypt::RSA problems

The code in which I actually use the Crypt::RSA stuff is below

That code does not compile :)

Replies are listed 'Best First'.
Re^2: Perl Crypt::RSA problems
by shug94 (Sexton) on Oct 22, 2009 at 07:02 UTC
    OK, I'll bite. I am unsure if you are telling me that I need to include my entire chunk of code (cause clearly this is a fragment that won't compile on its own), or if there is some really obvious problem that I am just not seeing.

    I have pulled my code out of the context I am using it, and have written a little bit of practise code to try to get this to work. The practise code still has the same error.

    #!/usr/bin/perl use strict; use Crypt::RSA; print "RSA tester\n"; my $infoToSign = "blah"; my $privateKey = 5; my $rsa = new Crypt::RSA; my $signatureValue = $rsa->sign( Message => $infoToSign, Key => $privateKey,);

    I still get the same problem. I realise that my key in this example is not legitimate, but it should still work, right?

    I might try generating a key using Crypt::RSA too.

      Crypt::RSA says the key argument is a "Private key of the sender, a Crypt::RSA::Key::Private(3) or compatible object." On the other hand, you're passing an unblessed scalar, which has no methods, rather than an object with the API Crypt::RSA expects.

      You'll probably want to use something like
      $private = [doc://Crypt::RSA::Key::Private]->new(filename=>$private_key_file)
      to load the private key, and then pass that object along to sign().