Source Code Cross Referenced for MonetaryLimit.java in  » Security » Bouncy-Castle » org » bouncycastle » asn1 » isismtt » x509 » 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 » Security » Bouncy Castle » org.bouncycastle.asn1.isismtt.x509 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.bouncycastle.asn1.isismtt.x509;
002:
003:        import org.bouncycastle.asn1.ASN1Encodable;
004:        import org.bouncycastle.asn1.ASN1EncodableVector;
005:        import org.bouncycastle.asn1.ASN1Sequence;
006:        import org.bouncycastle.asn1.DERInteger;
007:        import org.bouncycastle.asn1.DERObject;
008:        import org.bouncycastle.asn1.DERPrintableString;
009:        import org.bouncycastle.asn1.DERSequence;
010:
011:        import java.math.BigInteger;
012:        import java.util.Enumeration;
013:
014:        /**
015:         * Monetary limit for transactions. The QcEuMonetaryLimit QC statement MUST be
016:         * used in new certificates in place of the extension/attribute MonetaryLimit
017:         * since January 1, 2004. For the sake of backward compatibility with
018:         * certificates already in use, components SHOULD support MonetaryLimit (as well
019:         * as QcEuLimitValue).
020:         * <p/>
021:         * Indicates a monetary limit within which the certificate holder is authorized
022:         * to act. (This value DOES NOT express a limit on the liability of the
023:         * certification authority).
024:         * <p/>
025:         * <pre>
026:         *    MonetaryLimitSyntax ::= SEQUENCE
027:         *    {
028:         *      currency PrintableString (SIZE(3)),
029:         *      amount INTEGER,
030:         *      exponent INTEGER
031:         *    }
032:         * </pre>
033:         * <p/>
034:         * currency must be the ISO code.
035:         * <p/>
036:         * value = amount�10*exponent
037:         */
038:        public class MonetaryLimit extends ASN1Encodable {
039:            DERPrintableString currency;
040:            DERInteger amount;
041:            DERInteger exponent;
042:
043:            public static MonetaryLimit getInstance(Object obj) {
044:                if (obj == null || obj instanceof  MonetaryLimit) {
045:                    return (MonetaryLimit) obj;
046:                }
047:
048:                if (obj instanceof  ASN1Sequence) {
049:                    return new MonetaryLimit(ASN1Sequence.getInstance(obj));
050:                }
051:
052:                throw new IllegalArgumentException(
053:                        "unknown object in getInstance");
054:            }
055:
056:            private MonetaryLimit(ASN1Sequence seq) {
057:                if (seq.size() != 3) {
058:                    throw new IllegalArgumentException("Bad sequence size: "
059:                            + seq.size());
060:                }
061:                Enumeration e = seq.getObjects();
062:                currency = DERPrintableString.getInstance(e.nextElement());
063:                amount = DERInteger.getInstance(e.nextElement());
064:                exponent = DERInteger.getInstance(e.nextElement());
065:            }
066:
067:            /**
068:             * Constructor from a given details.
069:             * <p/>
070:             * <p/>
071:             * value = amount�10^exponent
072:             *
073:             * @param currency The currency. Must be the ISO code.
074:             * @param amount   The amount
075:             * @param exponent The exponent
076:             */
077:            public MonetaryLimit(String currency, int amount, int exponent) {
078:                this .currency = new DERPrintableString(currency, true);
079:                this .amount = new DERInteger(amount);
080:                this .exponent = new DERInteger(exponent);
081:            }
082:
083:            public String getCurrency() {
084:                return currency.getString();
085:            }
086:
087:            public BigInteger getAmount() {
088:                return amount.getValue();
089:            }
090:
091:            public BigInteger getExponent() {
092:                return exponent.getValue();
093:            }
094:
095:            /**
096:             * Produce an object suitable for an ASN1OutputStream.
097:             * <p/>
098:             * Returns:
099:             * <p/>
100:             * <pre>
101:             *    MonetaryLimitSyntax ::= SEQUENCE
102:             *    {
103:             *      currency PrintableString (SIZE(3)),
104:             *      amount INTEGER,
105:             *      exponent INTEGER
106:             *    }
107:             * </pre>
108:             *
109:             * @return a DERObject
110:             */
111:            public DERObject toASN1Object() {
112:                ASN1EncodableVector seq = new ASN1EncodableVector();
113:                seq.add(currency);
114:                seq.add(amount);
115:                seq.add(exponent);
116:
117:                return new DERSequence(seq);
118:            }
119:
120:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.