01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /**
19: * @author Alexander Y. Kleymenov
20: * @version $Revision$
21: */package org.apache.harmony.security.x509;
22:
23: import org.apache.harmony.security.asn1.ASN1Sequence;
24: import org.apache.harmony.security.asn1.ASN1Type;
25: import org.apache.harmony.security.asn1.BerInputStream;
26:
27: /**
28: * The class encapsulates the ASN.1 DER encoding/decoding work
29: * with the ORAddress structure which is a part of X.509 certificate:
30: * (as specified in RFC 3280 -
31: * Internet X.509 Public Key Infrastructure.
32: * Certificate and Certificate Revocation List (CRL) Profile.
33: * http://www.ietf.org/rfc/rfc3280.txt):
34: *
35: * <pre>
36: * ORAddress ::= SEQUENCE {
37: * built-in-standard-attributes BuiltInStandardAttributes,
38: * built-in-domain-defined-attributes
39: * BuiltInDomainDefinedAttributes OPTIONAL,
40: * extension-attributes ExtensionAttributes OPTIONAL
41: * }
42: * </pre>
43: *
44: * TODO: this class needs to be finished.
45: */
46: public class ORAddress {
47:
48: // the ASN.1 encoded form of ORAddress
49: private byte[] encoding;
50:
51: /**
52: * TODO
53: */
54: public ORAddress() {
55: }
56:
57: /**
58: * Returns ASN.1 encoded form of this X.509 ORAddress value.
59: * @return a byte array containing ASN.1 encode form.
60: */
61: public byte[] getEncoded() {
62: if (encoding == null) {
63: encoding = ASN1.encode(this );
64: }
65: return encoding;
66: }
67:
68: /**
69: * ASN.1 DER X.509 ORAddress encoder/decoder class.
70: */
71: public static final ASN1Sequence ASN1 = new ASN1Sequence(
72: new ASN1Type[] { new ASN1Sequence(new ASN1Type[] {}) {
73: protected Object getDecodedObject(Object[] values) {
74: return null;
75: }
76:
77: protected void getValues(Object object, Object[] values) {
78: }
79: } }) {
80:
81: protected Object getDecodedObject(BerInputStream in) {
82: return new ORAddress();
83: }
84:
85: private final Object foo = new Object(); //$NON-LOCK-1$
86:
87: protected void getValues(Object object, Object[] values) {
88: values[0] = foo;
89: }
90: };
91: }
|