Package org.apache.directory.shared.asn1.der

Examples of org.apache.directory.shared.asn1.der.DERSequence


                    DERInteger nameType = ( DERInteger ) derObject;
                    principalName.setNameType( nameType.intValue() );
                    break;
                   
                case 1:
                    DERSequence nameString = ( DERSequence ) derObject;
                    decodeNameString( nameString, principalName );
                    break;
            }
        }
View Full Code Here


     * }
     */
    protected static DERSequence encodeSequence( HostAddresses hosts )
    {
        HostAddress[] addresses = hosts.getAddresses();
        DERSequence sequence = new DERSequence();

        for ( int ii = 0; ii < addresses.length; ii++ )
        {
            sequence.add( encode( addresses[ii] ) );
        }

        return sequence;
    }
View Full Code Here

     *                     address[1]               OCTET STRING
     * }
     */
    protected static DERSequence encode( HostAddress host )
    {
        DERSequence sequence = new DERSequence();

        sequence.add( new DERTaggedObject( 0, DERInteger.valueOf( host.getAddrType().getOrdinal() ) ) );
        sequence.add( new DERTaggedObject( 1, new DEROctetString( host.getAddress() ) ) );

        return sequence;
    }
View Full Code Here

     * @param encryptedData
     * @return The {@link DERSequence}.
     */
    public static DERSequence encodeSequence( EncryptedData encryptedData )
    {
        DERSequence sequence = new DERSequence();

        sequence.add( new DERTaggedObject( 0, DERInteger.valueOf( encryptedData.getEType().getOrdinal() ) ) );

        if ( encryptedData.hasKvno() )
        {
            sequence.add( new DERTaggedObject( 1, DERInteger.valueOf( encryptedData.getKvno() ) ) );
        }

        sequence.add( new DERTaggedObject( 2, new DEROctetString( encryptedData.getCipher() ) ) );

        return sequence;
    }
View Full Code Here

     */
    public EncryptionTypeInfo2Entry[] decode( byte[] encodedEntries ) throws IOException
    {
        ASN1InputStream ais = new ASN1InputStream( encodedEntries );

        DERSequence sequence = ( DERSequence ) ais.readObject();

        return decodeSequence( sequence );
    }
View Full Code Here

     * }
     */
    protected static DERSequence encode( LastRequest lastReq )
    {
        LastRequestEntry[] entries = lastReq.getEntries();
        DERSequence outerSequence = new DERSequence();

        for ( int ii = 0; ii < entries.length; ii++ )
        {
            DERSequence sequence = new DERSequence();
            sequence
                .add( new DERTaggedObject( 0, DERInteger.valueOf( entries[ii].getLastRequestType().getOrdinal() ) ) );
            sequence.add( new DERTaggedObject( 1, DERGeneralizedTime.valueOf( entries[ii].getLastRequestValue()
                .toDate() ) ) );
            outerSequence.add( sequence );
        }

        return outerSequence;
View Full Code Here

        EncryptionTypeInfo2Entry[] entrySequence = new EncryptionTypeInfo2Entry[sequence.size()];

        int ii = 0;
        for ( Enumeration<DEREncodable> e = sequence.getObjects(); e.hasMoreElements(); )
        {
            DERSequence object = (DERSequence)e.nextElement();
            entrySequence[ii] = decode( object );
            ii++;
        }

        return entrySequence;
View Full Code Here

     *     enc-part[3]                  EncryptedData
     * }
     */
    protected static DERApplicationSpecific encode( Ticket ticket )
    {
        DERSequence vector = new DERSequence();

        vector.add( new DERTaggedObject( 0, DERInteger.valueOf( ticket.getTktVno() ) ) );
        vector.add( new DERTaggedObject( 1, DERGeneralString.valueOf( ticket.getRealm() ) ) );
        vector.add( new DERTaggedObject( 2, PrincipalNameEncoder.encode( ticket.getSName() ) ) );
        vector.add( new DERTaggedObject( 3, EncryptedDataEncoder.encodeSequence( ticket.getEncPart() ) ) );

        DERApplicationSpecific ticketSequence = null;

        try
        {
View Full Code Here

    }


    protected static DERSequence encodeSequence( Ticket[] tickets )
    {
        DERSequence outerVector = new DERSequence();

        for ( int ii = 0; ii < tickets.length; ii++ )
        {
            DERSequence vector = new DERSequence();
            vector.add( encode( tickets[ii] ) );
            outerVector.add( vector );
        }

        return outerVector;
    }
View Full Code Here

    public byte[] encode( PrivateMessage message ) throws IOException
    {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ASN1OutputStream aos = new ASN1OutputStream( baos );

        DERSequence privateMessageSequence = encodePrivateMessageSequence( message );
        aos
            .writeObject( DERApplicationSpecific
                .valueOf( message.getMessageType().getOrdinal(), privateMessageSequence ) );
        aos.close();
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.asn1.der.DERSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.