KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > jcetaglib > taglib > GetVersion


1 /*
2   Name: GetVersion.java
3   Licensing: LGPL
4
5   API: Sun (http://java.sun.com) JCE 1.2.2 API (cleanroom implementation by Bouncy Castle)
6   Provider: Bouncy Castle (http://www.bouncycastle.org)
7
8   Disclaimer:
9
10   COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND,
11   EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE
12   IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE
13   RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE
14   PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR)
15   ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY
16   CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED
17   HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
18 */

19
20 package net.sourceforge.jcetaglib.taglib;
21
22 import org.bouncycastle.jce.provider.BouncyCastleProvider;
23
24 import javax.servlet.jsp.JspException JavaDoc;
25 import javax.servlet.jsp.JspWriter JavaDoc;
26 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
27 import java.io.IOException JavaDoc;
28 import java.security.Provider JavaDoc;
29
30 /**
31  * JSP tag to print out BouncyCastle JCE provider and JCETaglib version number
32  *
33  * @jsp.tag
34  * name="getversion"
35  * display-name="GetVersion"
36  * body-content="empty"
37  * example="
38  * <%-- Generate a symmetric key file with default algorithm parameters

39  * 	(AES, 256 bit key, CBC/PKCS7Padding) --%>

40  * <jce:generatekey

41  * 	keyfile=\"c:/jspkey.key\"

42  * 	passphrase=\"<%= new StringBuffer(\"password\") %>\"/>"
43  *
44  * description="JSP tag to print out BouncyCastle JCE provider and JCETaglib version number"
45  *
46  * @author Gert Van Ham
47  * @author hamgert@users.sourceforge.net
48  * @author http://jcetaglib.sourceforge.net
49  * @version $Id: GetVersion.java,v 1.6 2004/04/15 07:28:35 hamgert Exp $
50  */

51 public class GetVersion extends TagSupport JavaDoc {
52     public int doStartTag() throws JspException JavaDoc {
53         Provider prov = new BouncyCastleProvider();
54
55         try {
56             JspWriter JavaDoc w = pageContext.getOut();
57             w.println("JCETaglib version: 1.0 Final<BR>");
58             w.println("JCE provider: " + prov.getName() + "<BR>");
59             w.println("JCE provider version: " + prov.getVersion() + "<BR>");
60             w.println("JCE provider info: " + prov.getInfo());
61         } catch (IOException JavaDoc ex) {
62             throw new JspException JavaDoc(ex.getMessage(), ex);
63         }
64
65         return SKIP_BODY;
66     } //doStartTag()
67
}
Popular Tags