.\" FreeSec: libcrypt for NetBSD .\" .\" Copyright (c) 1994 David Burren .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the author nor the names of other contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" %FreeBSD: src/secure/lib/libcipher/cipher. 3, v 1.6. 2.3 2001/12/14 15:21:13 ru Exp % .\" $FreeBSD: doc/ja_JP.eucJP/man/man3/cipher. 3, v 1.2 2002/05/18 07:12:53 horikawa Exp $ .\" .\" Manual page, using -mandoc macros .\" .Dd March 9, 1994 .Dt CIPHER 3 .Os "FreeSec 1.0" .Sh ¸íĪ .Nm setkey , .Nm encrypt , .Nm des_setkey , .Nm des_cipher .Nd DES ¾Ïȣȭ .Sh ÇÁ·Î±×·¥ ¶óÀ̺귯¸® .Lb libcipher .Sh ¼­½Ä .In unistd.h .Ft int .Fn setkey "const char *key" .Ft int .Fn encrypt "char *block" "int flag" .Ft int .Fn des_setkey "const char *key" .Ft int .Fn des_cipher "const char *in" "char *out" "long salt" "int count" .Sh ÇØ¼³ .Fn encrypt , .Fn setkey , .Fn des_setkey , .Fn des_cipher ÇÔ¼ö´Â, .Tn DES ¾Ë°í¸®Áò¿¡ÀÇ ¾×¼¼½º ¼ö´ÜÀ» Á¦°øÇÕ´Ï´Ù. .Fn setkey ¿¡´Â, ¹ÙÀ̳ʸ®Ä¡ (¼öÄ¡ 0 ¶Ç´Â 1)¸¦ °¡Áö´Â 64¹ÙÀÌÆ®ÀÇ ¹è¿­À» °Ç³×ÁÝ´Ï´Ù. ÀÌ ¹è¿­·ÎºÎÅÍ 56 ºñÆ®ÀÇ ¿­¼è°¡ ²¨³»Áý´Ï´Ù. À̰ÍÀº, ¹è¿­À» 8 ¹ÙÀÌÆ®ÀÇ ±×·ì¿¡ ºÐÇÒÇØ, °¢ ±×·ìÀÇ ¸¶Áö¸· ºñÆ®¸¦ ¹«½ÃÇÏ´Â °ÍÀ¸·Î ÇàÇÕ´Ï´Ù. ÀÌ ºñÆ®´Â DES ¿¡ ÀÇÇØ ¹ÙÀÌÆ® ÆÐ¸®Æ¼ °Ë»ç¸¦ À§Çؼ­(¶§¹®¿¡) ¿¹¾àµÇ°í ÀÖ½À´Ï´Ù¸¸, ÀÌ·¯ÇÑ ÇÔ¼ö´Â ÀÌ ºñÆ®¸¦ ¹«½ÃÇÕ´Ï´Ù. .Pp .Fn encrypt ÀÇ Àμö .Fa block µµ ¶ÇÇÑ, ¹ÙÀ̳ʸ®Ä¡¸¦ °¡Áö´Â 64 ¹ÙÀÌÆ®ÀÇ ¹è¿­ÀÔ´Ï´Ù. .Fa flag ÀÇ °ªÀÌ 0 ÀÇ °æ¿ì, .Fa block (Àº)´Â ¾ÏȣȭµË´Ï´Ù. ±× ÀÌ¿ÜÀÇ °æ¿ì´Â º¹È£È­(decode) µË´Ï´Ù. .Fn setkey ¿¡ ÀÇÇØ ÁöÁ¤ÇÑ ¿­¼è¸¦ »ç¿ëÇØ, ¹è¿­ÀÇ °ªÀ» ó¸®ÇÑ ´ÙÀ½¿¡, ó¸® °á°ú´Â ¿ø·¡ÀÇ ¹è¿­ .Fa block ¿¡ µ¹·ÁÁÖ¾îÁý´Ï´Ù. .Pp .Fn des_setkey ÀÇ Àμö´Â ±æÀÌ 8 ÀÇ Ä³¸¯ÅÍÀÇ ¹è¿­ÀÔ´Ï´Ù. °¢ ij¸¯ÅÍÀÇ ÃÖÇÏÁ¤µµ ºñÆ® (ÆÐ¸®Æ¼ ºñÆ®)´Â ¹«½ÃµÇ¾î ³ª¸ÓÁöÀÇ ºñÆ®¸¦ ºÙ¿© 56 ºñÆ®ÀÇ ¿­¼è¸¦ Çü¼ºÇÕ´Ï´Ù. .Fn des_cipher ÇÔ¼ö´Â .Fa count ÀÇ .Xr abs 3 ȸ .Tn DES (À»)¸¦ ¹Ýº¹ÇØ, .Fa in ¿¡ ÀÖ´Â 8 ij¸¯ÅÍ¿¡ °Ý³³µÈ 64 ºñÆ®ÀÇ °ªÀ» ¾Ïȣȭ ( .Fa count ÇÏÁö¸¸ ºÎÀÇ °æ¿ì´Â º¹È£È­(decode)) ÇØ, °á°úÀÇ 64 ºñÆ®¸¦ 8 ij¸¯ÅÍ·Î ÇØ .Fa out (À̰ÍÀº, .Fa in (¿Í)°ú °°Àº Àå¼Ò¿¡¼­µµ »ó°üÇÏÁö ¾Ê½À´Ï´Ù) ¿¡ °Ý³³ÇÕ´Ï´Ù. .Fa salt ÇÏ .Tn DES ¾Ë°í¸®Áò¿¡ ´ëÇØ, 16777216 ¹æ¹ý ¶Ç´Â 4096 ¹æ¹ý (Áï, 24 ºñÆ® ¶Ç´Â 12 ºñÆ®) Áß¿¡¼­ 1 ¹æ¹ýÀ̶ó°í ÇÏ´Â ºÒ±ÔÄ¢¼ºÀ» µµÀÔÇÕ´Ï´Ù ( .Ar salt ÀÇ ºñÆ® .Em i ÇÏÁö¸¸ ¼³Á¤µÇ¾î ÀÖ´Â °æ¿ì, .Tn DES E-box Ãâ·ÂÁßÀÇ ºñÆ® .Em i (¿Í)°ú ºñÆ® .Em i+24 (ÀÌ)°¡ ±³È¯µË´Ï´Ù). .Pp .Fn setkey , .Fn encrypt , .Fn des_setkey , .Fn des_cipher ÇÔ¼ö´Â 󸮿¡ ¼º°øÇßÀ» °æ¿ì 0 À» µ¹·ÁÁÖ¾î, ½ÇÆÐÇßÀ» °æ¿ì 1 À» µ¹·ÁÁÝ´Ï´Ù. .Pp .Fn setkey (¿Í)°ú .Fn des_setkey ÇÔ¼ö´Â °°Àº ¿­¼è °ø°£À» Á¶ÀÛÇÕ´Ï´Ù. .Sh °ü·Ã Ç׸ñ .Xr login 1 , .Xr passwd 1 , .Xr crypt 3 , .Xr getpass 3 , .Xr passwd 5 .Sh ¿ª»ç ÀÌ ÇÁ·Î±×·¥ ¶óÀ̺귯¸® (FreeSec 1.0)´Â, ¾Æ¸Þ¸®Ä« ÇÕÁß±¹¸¸À¸·Î »ç¿ëÇÒ ¼ö ÀÖ´Ù .Nx libcrypt ¾Ïȣȭ ÇÁ·Î±×·¥ ¶óÀ̺귯¸®¿¡ ´ëÇØ¼­, ±×·¯ÇÑ ÀåÇØ°¡ ¾ø´Â ġȯÀ¸·Î¼­ ¾Æ¸Þ¸®Ä« ÇÕÁß±¹ÀÇ ¹Û¿¡¼­ °³¹ßµÇ¾ú½À´Ï´Ù. À¯Àú´Â, ÀÌ ÄÚµå (°÷ÀÇ ÇÁ·Î±×·¥ ¶óÀ̺귯¸®¸¦ Á¤Àû ¸µÅ© ÇÑ ÇÁ·Î±×·¥)´Â ÇÕÁß±¹ÀÇ ¹Û¿¡ ¼öÃâÇÒ ¼ö ¾ø´Â °ÍÀ» ÀÌÇØÇØ µÎÁö ¾ÊÀ¸¸é µÇÁö ¾Ê½À´Ï´Ù. ¹«¾ùº¸´Ù, ¼öÀÔÇÒ ¼ö ÀÖ´Â °ÍÀº ºÐ¸íÇÕ´Ï´Ù¸¸. .Sh ÀúÀÚ .An David Burren Aq davidb@werj.com.au