use Crypt::OpenSSL::Bignum::CTX;
use Digest::SHA1;
use MIME::Base64;
+use POSIX;
## make sure all length() and substr() calls use bytes only:
use bytes;
$bitlen = unpack('n', $bitlen);
$$readtally += 2;
- my $bytestoread = ($bitlen + 7)/8;
+ my $bytestoread = POSIX::floor(($bitlen + 7)/8);
my $ret;
read($instr, $ret, $bytestoread) or die "could not read MPI body.\n";
$$readtally += $bytestoread;
if (/^pem2openpgp$/) {
my $rsa;
my $stdin;
+
+ my $uid = shift;
+ defined($uid) or die "You must specify a user ID string.\n";
+
+ # FIXME: fail if there is no given user ID; or should we default to
+ # hostname_long() from Sys::Hostname::Long ?
+
+
if (defined $ENV{PEM2OPENPGP_NEWKEY}) {
$rsa = Crypt::OpenSSL::RSA->generate_key($ENV{PEM2OPENPGP_NEWKEY});
} else {
$rsa = Crypt::OpenSSL::RSA->new_private_key($stdin);
}
- my $uid = shift;
-
- # FIXME: fail if there is no given user ID; or should we default to
- # hostname_long() from Sys::Hostname::Long ?
-
print pem2openpgp($rsa,
$uid,
{ timestamp => $ENV{PEM2OPENPGP_TIMESTAMP},