473,473 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

RSA Key File Problems in ActivePerl

8 New Member
Hi everyone!
I'm working on an RSA project that has to communicate with ASP.NET.

Here's my problem:
I'm following the code here:
http://cpan.uwinnipeg.ca/htdocs/Cryp...Crypt/RSA.html

This code by itself runs fine. However, when I start trying to push out the key to an external file (for later use of course) things start to get a little messy.

Expand|Select|Wrap|Line Numbers
  1. use Crypt::RSA;
  2.  
  3. my $rsa = new Crypt::RSA( ES => 'PKCS1v15' );
  4. my $message = "RSA is FUN!!";
  5. my ($public, $private) = $rsa->keygen(
  6.     Identity    => 'PTSIntranetApplications@<RMed by MOD>',
  7.     Size        => 1024,
  8.     Verbosity    => 0,
  9.     Filename    => 'key',
  10. ) or die $rsa->errstr();
  11.  
This Code by itself works okay too. It's only when I try to encrypt it do I run into to problems (note: this is the next set of code right after above code):
Expand|Select|Wrap|Line Numbers
  1. my $pubKey = new Crypt::RSA::Key::Public( Filename => 'key.public');
  2. my $cyphertext = $rsa->encrypt(
  3.     Message    => $message,
  4.     Key        => $pubKey,
  5.     Armour    => 1,
  6. ) or die $rsa->errstr();
  7.  
I then get this error:
n is not p*q.
I realize this is from the "Check" function in the RSA object. However, I'm not doing anything to the keys to screw up their values.

Am I doing something wrong? If so, what am I doing and what can I do to fix this problem?

Thanks for your help!

Michael

***EDIT:

I should also note that when using RSA object without any file export/import, it works perfectly fine.
Jun 8 '07 #1
3 1703
TheWalWorker
8 New Member
So apparently: I was wrong for a couple things:

1) the error only occurred in the private key not the public key (stupid me)
2) The error only occurred because I wanted to use 1 key from memory and one key from the file.... Obviously, no one likes that.

So it's fixed. Thanks for checking it out if you did. Hope this helps someone!
Jun 8 '07 #2
miller
1,089 Recognized Expert Top Contributor
Kudos.

- Miller

PS
I've removed the email address that you included in your original post so that you do not get any spam.
Jun 8 '07 #3
TheWalWorker
8 New Member
Thank you! :) I appreciate your help! :)
Jun 11 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: WS | last post by:
Hello, I am trying to tidy up my ActivePerl installation by refreshing the packages. Everything works fine except for perl-ldap. Whenever I check for a new version (upgrade --install) a new one...
3
by: Hugz | last post by:
Hello, And Thank you for taking time to help me.Myself Hugz.I am new to perl and want to write my own Scripts.But i can't understand how perl "rename" function and "file locking" works. ...
3
by: Skybuck Flying | last post by:
Hi, I download some perl source code and the manual says: perl Makefile.PL make make install The first line went ok.
2
by: bbxrider | last post by:
i'm new at this so, please bear with me win2k adv serv, iis5.0, front page extensions installed, activeperl installed can asp and activeperl coexist on the same iis server? the install for the...
4
by: Studentmadhura05 | last post by:
I was asked to use the local machine to code in PERL using ActivePERL software. I have no clue how to use it. I am trying to figure out but some quick help will be highly appreciated. Thanks
2
by: sbettadpur | last post by:
Hello Team I am trying to install Bugzilla on Windows 2003 Bugzilla version: bugzilla-3.0.5 and ActivePerl Version : v5.8.8.864 The problem is When I tryied...
3
by: askperl | last post by:
Hello Folks, I need a little bit of Help in editing a HTML file. From what i know,i can't directly edit the file using PERL(activePERL,running on windows). i have few questions here,any answers...
3
by: DavidCZ | last post by:
I have a page using Perlscript in ASP. I installed ActivePerl 5.6, 5.8, and 5.10 to no success. I am running the page in IIS on XP SP3. The program is as follows: <%@ Language=PerlScript %> ...
6
by: fheleno | last post by:
Hi, I am using Activeperl 5.10. Its replace methods or functions do not seem working. I need to replace every uppercase letter by its corresponding lowercase. I used $str=~ s/A-Z/a-z/; ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.