Source Code Cross Referenced for AnySHA.java in  » Web-Framework » anvil » anvil » core » crypto » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Framework » anvil » anvil.core.crypto 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: AnySHA.java,v 1.5 2002/09/16 08:05:02 jkl Exp $
003:         *
004:         * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
005:         *
006:         * Use is subject to license terms, as defined in
007:         * Anvil Sofware License, Version 1.1. See LICENSE 
008:         * file, or http://njet.org/license-1.1.txt
009:         */
010:        package anvil.core.crypto;
011:
012:        import anvil.core.Any;
013:        import anvil.script.Context;
014:        import java.security.InvalidKeyException;
015:        import java.security.MessageDigest;
016:        import java.security.NoSuchAlgorithmException;
017:        import javax.crypto.Mac;
018:        import javax.crypto.SecretKey;
019:        import javax.crypto.spec.SecretKeySpec;
020:
021:        ///
022:        /// @class SHA
023:        ///   This class is used for creating message hash codes:
024:        ///   <i>Message Digest</i> or <i>Message Authentication Code (MAC)</i>.
025:        ///
026:
027:        /**
028:         * class SHA
029:         *
030:         * @author: Jaripekka Salminen
031:         */
032:        public class AnySHA extends AnyMessageHash {
033:
034:            ///
035:            /// @constructor SHA
036:            /// @synopsis SHA SHA() ; When the SHA algorithm is used without 
037:            ///   any key, it will return a MessageHash datatype, which will make 
038:            ///   a <i>SHA message digest</i> from the data given to it.
039:            /// @synopsis SHA SHA(object key) ; When the SHA algorith is given 
040:            ///   a key (string or binary), it will return a MessageHash datatype, 
041:            ///   which will make a <i>HmacSHA1 message authentication code</i>
042:            ///   from the data given to it.
043:            /// 
044:            /// @param key string or binary key
045:            /// @return message hash
046:            ///
047:            public static final Object[] newInstance = { null, "*key", null };
048:
049:            public static final Any newInstance(Context context, Any key) {
050:                CryptoModule.init();
051:                try {
052:                    if (key == null) {
053:                        return new AnyMessageHash("SHA");
054:                    } else {
055:                        return new AnyMessageHash("HmacSHA1", key);
056:                    }
057:                } catch (Exception e) {
058:                    throw context.exception(e);
059:                }
060:            }
061:
062:            public static final anvil.script.compiler.NativeClass __class__ = new anvil.script.compiler.NativeClass(
063:                    "SHA", AnySHA.class,
064:                    AnyMessageHash.__class__,
065:                    //DOC{{
066:                    ""
067:                            + "\n"
068:                            + " @class SHA\n"
069:                            + "   This class is used for creating message hash codes:\n"
070:                            + "   <i>Message Digest</i> or <i>Message Authentication Code (MAC)</i>.\n"
071:                            + "\n"
072:                            + "\n"
073:                            + " @constructor SHA\n"
074:                            + " @synopsis SHA SHA() ; When the SHA algorithm is used without \n"
075:                            + "   any key, it will return a MessageHash datatype, which will make \n"
076:                            + "   a <i>SHA message digest</i> from the data given to it.\n"
077:                            + " @synopsis SHA SHA(object key) ; When the SHA algorith is given \n"
078:                            + "   a key (string or binary), it will return a MessageHash datatype, \n"
079:                            + "   which will make a <i>HmacSHA1 message authentication code</i>\n"
080:                            + "   from the data given to it.\n" + " \n"
081:                            + " @param key string or binary key\n"
082:                            + " @return message hash\n" + "\n"
083:            //}}DOC
084:            );
085:            static {
086:                CryptoModule.class.getName();
087:            }
088:
089:            /*package*/AnySHA(String algorithm)
090:                    throws NoSuchAlgorithmException {
091:                super (algorithm);
092:            }
093:
094:            /*package*/AnySHA(String algorithm, Any anyKey)
095:                    throws NoSuchAlgorithmException, InvalidKeyException {
096:                super (algorithm, anyKey);
097:            }
098:
099:            public anvil.script.ClassType classOf() {
100:                return __class__;
101:            }
102:
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.