Server IP : 103.119.228.120 / Your IP : 18.119.124.52 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mail::DKIM::Signer 3" .TH Mail::DKIM::Signer 3 "2012-11-28" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::DKIM::Signer \- generates a DKIM signature for a message .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Mail::DKIM::Signer; \& use Mail::DKIM::TextWrap; #recommended \& \& # create a signer object \& my $dkim = Mail::DKIM::Signer\->new( \& Algorithm => "rsa\-sha1", \& Method => "relaxed", \& Domain => "example.org", \& Selector => "selector1", \& KeyFile => "private.key", \& ); \& \& # read an email from a file handle \& $dkim\->load(*STDIN); \& \& # or read an email and pass it into the signer, one line at a time \& while (<STDIN>) \& { \& # remove local line terminators \& chomp; \& s/\e015$//; \& \& # use SMTP line terminators \& $dkim\->PRINT("$_\e015\e012"); \& } \& $dkim\->CLOSE; \& \& # what is the signature result? \& my $signature = $dkim\->signature; \& print $signature\->as_string; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class is the part of Mail::DKIM responsible for generating signatures for a given message. You create an object of this class, specifying the parameters of the signature you wish to create, or specifying a callback function so that the signature parameters can be determined later. Next, you feed it the entire message using \&\*(L"\s-1\fIPRINT\s0()\fR\*(R", completing with \*(L"\s-1\fICLOSE\s0()\fR\*(R". Finally, use the \&\*(L"\fIsignatures()\fR\*(R" method to access the generated signatures. .SS "Pretty Signatures" .IX Subsection "Pretty Signatures" Mail::DKIM includes a signature-wrapping module (which inserts linebreaks into the generated signature so that it looks nicer in the resulting message. To enable this module, simply call .PP .Vb 1 \& use Mail::DKIM::TextWrap; .Ve .PP in your program before generating the signature. .SH "CONSTRUCTOR" .IX Header "CONSTRUCTOR" .SS "\fInew()\fP" .IX Subsection "new()" Construct an object-oriented signer. .PP .Vb 8 \& # create a signer using the default policy \& my $dkim = Mail::DKIM::Signer\->new( \& Algorithm => "rsa\-sha1", \& Method => "relaxed", \& Domain => "example.org", \& Selector => "selector1", \& KeyFile => "private.key", \& ); \& \& # create a signer using a custom policy \& my $dkim = Mail::DKIM::Signer\->new( \& Policy => $policyfn, \& ); .Ve .PP The \*(L"default policy\*(R" is to create a \s-1DKIM\s0 signature using the specified parameters, but only if the message's sender matches the domain. The following parameters can be passed to this \fInew()\fR method to influence the resulting signature: Algorithm, Method, Domain, Selector, KeyFile, Identity, Timestamp. .PP If you want different behavior, you can provide a \*(L"signer policy\*(R" instead. A signer policy is a subroutine or class that determines signature parameters after the message's headers have been parsed. See the section \*(L"\s-1SIGNER POLICIES\*(R"\s0 below for more information. .PP See Mail::DKIM::SignerPolicy for more information about policy objects. .PP In addition to the parameters demonstrated above, the following are recognized: .IP "Key" 4 .IX Item "Key" rather than using \f(CW\*(C`KeyFile\*(C'\fR, use \f(CW\*(C`Key\*(C'\fR to use an already-loaded Mail::DKIM::PrivateKey object. .SH "METHODS" .IX Header "METHODS" .SS "\s-1\fIPRINT\s0()\fP" .IX Subsection "PRINT()" Feed part of the message to the signer. .PP .Vb 1 \& $dkim\->PRINT("a line of the message\e015\e012"); .Ve .PP Feeds content of the message being signed into the signer. The \s-1API\s0 is designed this way so that the entire message does \s-1NOT\s0 need to be read into memory at once. .PP Please note that although the \s-1\fIPRINT\s0()\fR method expects you to use SMTP-style line termination characters, you should \s-1NOT\s0 use the SMTP-style dot-stuffing technique described in \s-1RFC 2821\s0 section 4.5.2. Nor should you use a <\s-1CR\s0><\s-1LF\s0>.<\s-1CR\s0><\s-1LF\s0> sequence to terminate the message. .SS "\s-1\fICLOSE\s0()\fP" .IX Subsection "CLOSE()" Call this when finished feeding in the message. .PP .Vb 1 \& $dkim\->CLOSE; .Ve .PP This method finishes the canonicalization process, computes a hash, and generates a signature. .SS "\fIadd_signature()\fP" .IX Subsection "add_signature()" Used by signer policy to create a new signature. .PP .Vb 1 \& $dkim\->add_signature(new Mail::DKIM::Signature(...)); .Ve .PP Signer policies can use this method to specify complete parameters for the signature to add, including what type of signature. For more information, see Mail::DKIM::SignerPolicy. .SS "\fIalgorithm()\fP" .IX Subsection "algorithm()" Get or set the selected algorithm. .PP .Vb 1 \& $alg = $dkim\->algorithm; \& \& $dkim\->algorithm("rsa\-sha1"); .Ve .SS "\fIdomain()\fP" .IX Subsection "domain()" Get or set the selected domain. .PP .Vb 1 \& $alg = $dkim\->domain; \& \& $dkim\->domain("example.org"); .Ve .SS "\fIload()\fP" .IX Subsection "load()" Load the entire message from a file handle. .PP .Vb 1 \& $dkim\->load($file_handle); .Ve .PP Reads a complete message from the designated file handle, feeding it into the signer. The message must use <\s-1CRLF\s0> line terminators (same as the \s-1SMTP\s0 protocol). .SS "\fIheaders()\fP" .IX Subsection "headers()" Determine which headers to put in signature. .PP .Vb 1 \& my $headers = $dkim\->headers; .Ve .PP This is a string containing the names of the header fields that will be signed, separated by colons. .SS "\fIkey()\fP" .IX Subsection "key()" Get or set the private key object. .PP .Vb 1 \& my $key = $dkim\->key; \& \& $dkim\->key(Mail::DKIM::PrivateKey\->load(File => "private.key")); .Ve .PP The key object can be any object that implements the \&\fIsign_digest()\fR method. (Providing your own object can be useful if your actual keys are stored out-of-process.) .PP If you use this method to specify a private key, do not use \*(L"\fIkey_file()\fR\*(R". .SS "\fIkey_file()\fP" .IX Subsection "key_file()" Get or set the filename containing the private key. .PP .Vb 1 \& my $filename = $dkim\->key_file; \& \& $dkim\->key_file("private.key"); .Ve .PP If you use this method to specify a private key file, do not use \*(L"\fIkey()\fR\*(R". .SS "\fImethod()\fP" .IX Subsection "method()" Get or set the selected canonicalization method. .PP .Vb 1 \& $alg = $dkim\->method; \& \& $dkim\->method("relaxed"); .Ve .SS "\fImessage_originator()\fP" .IX Subsection "message_originator()" Access the \*(L"From\*(R" header. .PP .Vb 1 \& my $address = $dkim\->message_originator; .Ve .PP Returns the \*(L"originator address\*(R" found in the message, as a Mail::Address object. This is typically the (first) name and email address found in the From: header. If there is no From: header, then an empty Mail::Address object is returned. .PP To get just the email address part, do: .PP .Vb 1 \& my $email = $dkim\->message_originator\->address; .Ve .PP See also \*(L"\fImessage_sender()\fR\*(R". .SS "\fImessage_sender()\fP" .IX Subsection "message_sender()" Access the \*(L"From\*(R" or \*(L"Sender\*(R" header. .PP .Vb 1 \& my $address = $dkim\->message_sender; .Ve .PP Returns the \*(L"sender\*(R" found in the message, as a Mail::Address object. This is typically the (first) name and email address found in the Sender: header. If there is no Sender: header, it is the first name and email address in the From: header. If neither header is present, then an empty Mail::Address object is returned. .PP To get just the email address part, do: .PP .Vb 1 \& my $email = $dkim\->message_sender\->address; .Ve .PP The \*(L"sender\*(R" is the mailbox of the agent responsible for the actual transmission of the message. For example, if a secretary were to send a message for another person, the \*(L"sender\*(R" would be the secretary and the \*(L"originator\*(R" would be the actual author. .SS "\fIselector()\fP" .IX Subsection "selector()" Get or set the current key selector. .PP .Vb 1 \& $alg = $dkim\->selector; \& \& $dkim\->selector("alpha"); .Ve .SS "\fIsignature()\fP" .IX Subsection "signature()" Access the generated signature object. .PP .Vb 1 \& my $signature = $dkim\->signature; .Ve .PP Returns the generated signature. The signature is an object of type Mail::DKIM::Signature. If multiple signatures were generated, this method returns the last one. .PP The signature (as text) should be \fBprepended\fR to the message to make the resulting message. At the very least, it should precede any headers that were signed. .SS "\fIsignatures()\fP" .IX Subsection "signatures()" Access list of generated signature objects. .PP .Vb 1 \& my @signatures = $dkim\->signatures; .Ve .PP Returns all generated signatures, as a list. .SH "SIGNER POLICIES" .IX Header "SIGNER POLICIES" The \fInew()\fR constructor takes an optional Policy argument. This can be a Perl object or class with an \fIapply()\fR method, or just a simple subroutine reference. The method/subroutine will be called with the signer object as an argument. The policy is responsible for checking the message and specifying signature parameters. The policy must return a nonzero value to create the signature, otherwise no signature will be created. E.g., .PP .Vb 2 \& my $policyfn = sub { \& my $dkim = shift; \& \& # specify signature parameters \& $dkim\->algorithm("rsa\-sha1"); \& $dkim\->method("relaxed"); \& $dkim\->domain("example.org"); \& $dkim\->selector("mx1"); \& \& # return true value to create the signature \& return 1; \& }; .Ve .PP Or the policy object can actually create the signature, using the add_signature method within the policy object. If you add a signature, you do not need to return a nonzero value. This mechanism can be utilized to create multiple signatures, or to create the older DomainKey-style signatures. .PP .Vb 10 \& my $policyfn = sub { \& my $dkim = shift; \& $dkim\->add_signature( \& new Mail::DKIM::Signature( \& Algorithm => "rsa\-sha1", \& Method => "relaxed", \& Headers => $dkim\->headers, \& Domain => "example.org", \& Selector => "mx1", \& )); \& $dkim\->add_signature( \& new Mail::DKIM::DkSignature( \& Algorithm => "rsa\-sha1", \& Method => "nofws", \& Headers => $dkim\->headers, \& Domain => "example.org", \& Selector => "mx1", \& )); \& return; \& }; .Ve .PP If no policy is specified, the default policy is used. The default policy signs every message using the domain, algorithm, method, and selector specified in the \fInew()\fR constructor. .SH "SEE ALSO" .IX Header "SEE ALSO" Mail::DKIM::SignerPolicy .SH "AUTHOR" .IX Header "AUTHOR" Jason Long, <jlong@messiah.edu> .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2006\-2007 by Messiah College .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.