Annotation of embedaddon/libpdel/util/rsa_util_sign.3, revision 1.1

1.1     ! misho       1: .\" Copyright (c) 2001-2002 Packet Design, LLC.
        !             2: .\" All rights reserved.
        !             3: .\" 
        !             4: .\" Subject to the following obligations and disclaimer of warranty,
        !             5: .\" use and redistribution of this software, in source or object code
        !             6: .\" forms, with or without modifications are expressly permitted by
        !             7: .\" Packet Design; provided, however, that:
        !             8: .\" 
        !             9: .\"    (i)  Any and all reproductions of the source or object code
        !            10: .\"         must include the copyright notice above and the following
        !            11: .\"         disclaimer of warranties; and
        !            12: .\"    (ii) No rights are granted, in any manner or form, to use
        !            13: .\"         Packet Design trademarks, including the mark "PACKET DESIGN"
        !            14: .\"         on advertising, endorsements, or otherwise except as such
        !            15: .\"         appears in the above copyright notice or in the software.
        !            16: .\" 
        !            17: .\" THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
        !            18: .\" TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
        !            19: .\" REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
        !            20: .\" THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
        !            21: .\" WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
        !            22: .\" OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
        !            23: .\" OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
        !            24: .\" OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
        !            25: .\" RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
        !            26: .\" LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
        !            27: .\" OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
        !            28: .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
        !            29: .\" DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
        !            30: .\" USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
        !            31: .\" LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            32: .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
        !            33: .\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
        !            34: .\" THE POSSIBILITY OF SUCH DAMAGE.
        !            35: .\"
        !            36: .\" Author: Archie Cobbs <archie@freebsd.org>
        !            37: .\"
        !            38: .\" $Id: rsa_util_sign.3,v 1.5 2004/06/02 17:24:39 archie Exp $
        !            39: .\"
        !            40: .Dd April 22, 2002
        !            41: .Dt RSA_UTIL_SIGN 3
        !            42: .Os
        !            43: .Sh NAME
        !            44: .Nm rsa_util_sign ,
        !            45: .Nm rsa_util_verify ,
        !            46: .Nm rsa_util_verify_priv
        !            47: .Nd RSA digital signature routines
        !            48: .Sh LIBRARY
        !            49: PDEL Library (libpdel, \-lpdel)
        !            50: .Sh SYNOPSIS
        !            51: .In sys/types.h
        !            52: .In pdel/util/rsa_util.h
        !            53: .Ft int
        !            54: .Fn rsa_util_sign "const char *privkeyfile" "const u_char *md5" "u_char *sig" "size_t siglen"
        !            55: .Ft int
        !            56: .Fn rsa_util_verify "const char *pubkeyfile" "const u_char *md5" "const u_char *sig" "size_t siglen"
        !            57: .Ft int
        !            58: .Fn rsa_util_verify_priv "const char *privkeyfile" "const u_char *md5" "const u_char *sig" "size_t siglen"
        !            59: .Sh DESCRIPTION
        !            60: These routines are convenience wrappers around the OpenSSL crypto library
        !            61: for creating and verifying RSA digital signatures.
        !            62: They use the
        !            63: .Xr md5 3
        !            64: hash of the original document for the actual signing operation.
        !            65: .Pp
        !            66: .Fn rsa_util_sign
        !            67: creates a digital signature.
        !            68: .Fa privkeyfile
        !            69: is the pathname of the private key file (which must be unencrypted).
        !            70: .Fa md5
        !            71: is the hash of the document to be signed.
        !            72: .Fa sig
        !            73: points to a buffer of at least 128 bytes.
        !            74: .Fa siglen
        !            75: is the size of the buffer.
        !            76: .Fn rsa_util_sign
        !            77: returns the length of the resulting signature, or -1 (with
        !            78: .Va errno
        !            79: set) if there was an error.
        !            80: .Pp
        !            81: .Fn rsa_util_verify
        !            82: verifies a digital signature.
        !            83: .Fa pubkeyfile
        !            84: is the pathname of the public key file.
        !            85: .Fa md5
        !            86: is the hash of the document to be signed.
        !            87: .Fa sig
        !            88: points to the signature to verify, having length
        !            89: .Fa siglen .
        !            90: .Fn rsa_util_verify
        !            91: returns 1 if the signature is valid, otherwise 0.
        !            92: .Pp
        !            93: .Fn rsa_util_verify_priv
        !            94: functions exactly like
        !            95: .Fn rsa_util_verify
        !            96: except that the private key file (which also contains the public key)
        !            97: is passed as the first argument.
        !            98: .Sh EXAMPLES
        !            99: To create a new RSA private key:
        !           100: .Bd -literal -offset 3n
        !           101: openssl genrsa -rand /dev/random -out mykey.key 1024
        !           102: 
        !           103: .Ed
        !           104: To view the contents of an RSA private key file:
        !           105: .Bd -literal -offset 3n
        !           106: openssl rsa -in mykey.key -text -noout
        !           107: 
        !           108: .Ed
        !           109: To extract the RSA public key from an RSA private key file:
        !           110: .Bd -literal -offset 3n
        !           111: openssl rsa -in mykey.key -pubout -out mykey.pub
        !           112: 
        !           113: .Ed
        !           114: To view the contents of an RSA public key file:
        !           115: .Bd -literal -offset 3n
        !           116: openssl rsa -pubin -in mykey.pub -text -noout
        !           117: .Ed
        !           118: .Sh SEE ALSO
        !           119: .Xr openssl 1 ,
        !           120: .Xr md5 3 ,
        !           121: .Xr libpdel 3
        !           122: .Sh HISTORY
        !           123: The PDEL library was developed at Packet Design, LLC.
        !           124: .Dv "http://www.packetdesign.com/"
        !           125: .Sh AUTHORS
        !           126: .An Archie Cobbs Aq archie@freebsd.org

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>