Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Crypt::X509 / Blessing error
Hi,

when i try to run this simple Crypt::X509 script, i have
this
error: "Attempt to bless into a reference at
/opt/perl_32/lib/site_perl/5.8.8/Crypt/X509.pm line 105."
I want to build a mailer to send alerts to our customer,
if they have to renew their certificates, the ldap
extraction is already running.
 ________________________________________
___________
use Crypt::X509;
#INITIALIZING
my $certfile="46B2D0D7.cer";
my $certificate;

open CERTFILE , $certfile or die "Error to open file";
binmode binmode
read (CERTFILE, $certificate, 65536);
close CERTFILE;

$decoded = new Crypt::X509->new( cert => $certificate );

print "Certificate Subject: ".$decoded->Subject;
 ________________________________________
___________

Does someone know what's wrong with this?

Thank you,
JL

Report this thread to moderator Post Follow-up to this message
Old Post
Jean-Luc Boss
08-22-07 01:17 PM


Re: Crypt::X509 / Blessing error
On 22/8/07 10:34, "Jean-Luc Boss" <jean-luc.boss@flaschenpost.cetrel.net>
wrote:

> Hi,
>
> when i try to run this simple Crypt::X509 script, i have
> this
> error: "Attempt to bless into a reference at
> /opt/perl_32/lib/site_perl/5.8.8/Crypt/X509.pm line 105."
> I want to build a mailer to send alerts to our customer,
> if they have to renew their certificates, the ldap
> extraction is already running.
>  ________________________________________
___________
> use Crypt::X509;
> #INITIALIZING
> my $certfile="46B2D0D7.cer";
> my $certificate;
>
> open CERTFILE , $certfile or die "Error to open file";
> binmode binmode

Presumably that ought to be:

binmode CERTFILE;

?

> read (CERTFILE, $certificate, 65536);
> close CERTFILE;
>
> $decoded = new Crypt::X509->new( cert => $certificate );
>
> print "Certificate Subject: ".$decoded->Subject;
>  ________________________________________
___________
>
> Does someone know what's wrong with this?

What happens if you single-step with the perl debugger?

Cheers,

Chris



Report this thread to moderator Post Follow-up to this message
Old Post
Chris Ridd
08-23-07 12:17 AM


Re: Crypt::X509 / Blessing error
Hello,

2007/8/22, Chris Ridd <chrisridd@mac.com>:
> On 22/8/07 10:34, "Jean-Luc Boss" <jean-luc.boss@flaschenpost.cetrel.net>=
wrote:
 
This happens in the following code:
sub new {
=09my ($class,%args) =3D @_;
=09if (!defined ($parser)) {
=09=09$parser=3D_init();
=09}
=09my $self =3D $parser->decode($args{'cert'});
=09
=09$self->{"_error"} =3D $parser->error;
=09bless ($self, $class);  <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Error comes down=
here
=09return $self;
}

This can only happen, when the given cert argument is not a string (or
scalar in Perl speak)

Like Chris already suggested, you probably give the new function an
undef, which leads to an uninitialised parser, that cannot be blessed.

Did the Tests work when you installed Crypt::X509 ? When you look in
the t subdirectory you'll find an example how to read a *binary*
certificate file and use the module.

Mit freundlichen Gr=FC=DFen,

Alexander Jung

Report this thread to moderator Post Follow-up to this message
Old Post
Alexander Jung
08-23-07 12:17 AM


Re: Crypt::X509 / Blessing error
On Aug 22, 2007, at 4:34 AM, Jean-Luc Boss wrote:
>
> $decoded = new Crypt::X509->new( cert => $certificate );

You are calling new on the result of calling new

take out that first 'new'

Graham.


Report this thread to moderator Post Follow-up to this message
Old Post
Graham Barr
08-23-07 03:16 AM


Re: Crypt::X509 / Blessing error
Hello,


2007/8/23, Graham Barr <gbarr@pobox.com>:
> On Aug 22, 2007, at 4:34 AM, Jean-Luc Boss wrote: 
> You are calling new on the result of calling new
thanks, I just looked into my code and did noch check his. oh well,
looks I'm getting old and selfish.

Mit freundlichen Gr=FC=DFen,

Alexander Jung

Report this thread to moderator Post Follow-up to this message
Old Post
Alexander Jung
08-23-07 09:30 AM


Re: Crypt::X509 / Blessing error
On Thu, 23 Aug 2007 08:28:16 +0200
"Alexander Jung" <alexander.w.jung@gmail.com> wrote:
>Hello,
>
>
>2007/8/23, Graham Barr <gbarr@pobox.com>: 
>thanks, I just looked into my code and did noch check
>his. oh well,
>looks I'm getting old and selfish.
>
>Mit freundlichen Grüßen,
>
>Alexander Jung

Thank you,

It works great now, i'm able to check all the certificates
in my LDAP now :)

Best regards,
Jean-Luc Boss

Report this thread to moderator Post Follow-up to this message
Old Post
Jean-Luc Boss
08-31-07 11:17 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

LDAP archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:11 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.