我想以数字方式签署.pdf文件,然后使用Crypt :: OpenSSL :: RSA创建附加的签名文件和分离的签名文件。 这就是我所做的:
初始化
my $s_pdf_file_to_sign = 'pdf_file_to_sign';
my $s_private_key_file = 'private_key_file';
my $s_cert_file = 'certificate_file';
阅读.pdf文件内容
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat $s_pdf_to_sign;
open FILE, "<$s_pdf_to_sign" or die "no such file";
binmode FILE;
my $s_pdf_to_sign_string;
read FILE, $s_pdf_to_sign_string, $size;
close FILE;
阅读私钥内容:
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat $s_private_key;
open FILE, "<$s_private_key" or die "no such file";
binmode FILE;
my $s_private_key_content;
read FILE, $s_private_key_content, $size;
close FILE;
创建private_key对象:
my $s_private_key_string = $s_private_key_content;
my $oref_rsa_priv = Crypt::OpenSSL::RSA->new_private_key($s_private_key_content) or die "new_private_key error";
签署pdf文件内容:
my $signature = $oref_rsa_priv->sign($s_pdf_content);
有人能告诉我包含$ signature变量的内容吗?我该怎么做才能创建附加和分离的签名?