in reply to Crypt::OpenSSL:RSA Questions
Superficially, it appears that you made an appropriate choice. Do you have any in-progress Perl code that you could share with us? (Or, for that matter, PHP code?) We’ll be happy to help you with that. (Remember to use code-tags, if it is large.)
It appears to me that this package has a very object-oriented approach, versus PHP’s decidedly functional one. PHP, more or less by-tradition, has a very monolithic approach to things, where you call certain functions to load information (into some “magic” but unknown location in space/time ...) so that other functions can subsequently refer to it. This object-oriented approach is much cleaner, but it does mean that the calling sequence will be different.
The corollary to openssl_get_privatekey(), it seems to me, would be the new_private_key() method, which is an object constructor. (There is also a new_public_key() method, although it seems to take a string whereas PHP takes a certificate file-name.)
Note – The Perl method-names are somewhat misleading: you are not, say, creating a “new private key.” Rather, you are invoking a variation of new() which takes a private-key string. What you wind-up with, is a Perl object instance.
Having thus successfully created a Perl object-instance which incorporates a key (using any one of the several methods provided), you would then invoke methods of that particular instance to do the various things that you need, such as signing a string or verifying a signed string.
Unfortunately, this module author’s documentation (sic ...) is working against you. The PerlDoc page is very ... sparse. C’est la guerre. Aside from the example, there seems to be no discussion of the actual methods ... merely an enumeration of the methods that exist. Nevertheless, I think that with a very short test-script, heavily based on such examples as there are, I think that you ought to be able to muddle-through how to use this module. And, I think that you did find the right one.
Try constructing a minimal test-script, and feel free to post it here for peer-review.
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Crypt::OpenSSL:RSA Questions
by martin87 (Initiate) on Jun 19, 2014 at 22:15 UTC | |
by gabush (Initiate) on Feb 24, 2016 at 11:38 UTC |