Home | History | Annotate | Download | only in x501
      1 /*
      2  *  Licensed to the Apache Software Foundation (ASF) under one or more
      3  *  contributor license agreements.  See the NOTICE file distributed with
      4  *  this work for additional information regarding copyright ownership.
      5  *  The ASF licenses this file to You under the Apache License, Version 2.0
      6  *  (the "License"); you may not use this file except in compliance with
      7  *  the License.  You may obtain a copy of the License at
      8  *
      9  *     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 * @author Stepan M. Mishura
     19 * @version $Revision$
     20 */
     21 
     22 package org.apache.harmony.security.x501;
     23 
     24 import org.apache.harmony.security.asn1.ASN1OpenType;
     25 import org.apache.harmony.security.asn1.ASN1Sequence;
     26 import org.apache.harmony.security.asn1.ASN1SetOf;
     27 import org.apache.harmony.security.asn1.ASN1Type;
     28 import org.apache.harmony.security.asn1.InformationObjectSet;
     29 
     30 
     31 /**
     32  * X.501 Attributes
     33  *
     34  * This is a draft class for Module InformationFramework (X.501).
     35  *
     36  * @see <a href="http://www.itu.int/ITU-T/asn1/database/itu-t/x/x501/2001/InformationFramework.html">X.501</a>
     37  */
     38 
     39 public class Attributes {
     40 
     41 
     42     /**
     43      * The class corresponds to following ASN.1 type:
     44      *
     45      * Attribute ::= SEQUENCE {
     46      *     type  AttributeType,
     47      *     values SET SIZE (0..MAX) OF AttributeValue }
     48      *
     49      * AttributeType ::= OBJECT IDENTIFIER
     50      *
     51      * AttributeValue ::= ANY DEFINED BY AttributeType
     52      *
     53      */
     54     public static ASN1Sequence getASN1(InformationObjectSet set) {
     55         ASN1OpenType.Id id = new ASN1OpenType.Id();
     56         ASN1OpenType any = new ASN1OpenType(id, set);
     57 
     58         return new ASN1Sequence(new ASN1Type[] { id, new ASN1SetOf(any) });
     59     }
     60 }
     61