Package org.apache.directory.shared.kerberos.components

Examples of org.apache.directory.shared.kerberos.components.EncKrbPrivPart


        {
            e.printStackTrace();
            fail();
        }
       
        EncKrbPrivPart encKrbPrivPart = container.getEncKrbPrivPart();
       
        HostAddress ad = new HostAddress( InetAddress.getByName( "127.0.0.1" ) );
       
        assertTrue( Arrays.equals( new byte[]{0,1}, encKrbPrivPart.getUserData() ) );
        assertNull( encKrbPrivPart.getTimestamp() );
        assertEquals( 0, encKrbPrivPart.getUsec() );
        assertEquals( 0, encKrbPrivPart.getSeqNumber() );
        assertEquals( ad, encKrbPrivPart.getSenderAddress() );
        assertNull( encKrbPrivPart.getRecipientAddress() );

        int computedLen = encKrbPrivPart.computeLength();
       
        assertEquals( streamLen, computedLen );
       
        try
        {
            ByteBuffer bb = ByteBuffer.allocate( computedLen );
           
            encKrbPrivPart.encode( bb );
           
            String encoded = Strings.dumpBytes(bb.array());
            assertEquals( decoded, encoded );
        }
        catch( EncoderException e )
View Full Code Here


     */
    private PrivateMessage getChangePasswordPrivateMessage( String newPassword, EncryptionKey subSessionKey )
            throws UnsupportedEncodingException, KerberosException, UnknownHostException
    {
        // Make private message part.
        EncKrbPrivPart encReqPrivPart = new EncKrbPrivPart();
        encReqPrivPart.setUserData( newPassword.getBytes( "UTF-8" ) );
        encReqPrivPart.setSenderAddress( new HostAddress( InetAddress.getLocalHost() ) );

        // Seal private message part.
        EncryptedData encryptedPrivPart = cipherTextHandler.seal( subSessionKey, encReqPrivPart, KeyUsage.KRB_PRIV_ENC_PART_CHOSEN_KEY );

        // Make private message with private message part.
View Full Code Here

    private PrivateMessage getSetPasswordPrivateMessage( String newPassword, EncryptionKey subSessionKey,
            PrincipalName targetPrincipalName ) throws UnsupportedEncodingException, KerberosException,
            UnknownHostException, IOException
    {
        // Make private message part.
        EncKrbPrivPart encReqPrivPart = new EncKrbPrivPart();

        ChangePasswordDataModifier dataModifier = new ChangePasswordDataModifier();
        dataModifier.setNewPassword( newPassword.getBytes() );
        dataModifier.setTargetName( targetPrincipalName );
        dataModifier.setTargetRealm( "EXAMPLE.COM" );
        ChangePasswordData data = dataModifier.getChangePasswdData();

        ChangePasswordDataEncoder encoder = new ChangePasswordDataEncoder();
        byte[] dataBytes = encoder.encode( data );

        encReqPrivPart.setUserData( dataBytes );

        encReqPrivPart.setSenderAddress( new HostAddress( InetAddress.getLocalHost() ) );

        // Seal private message part.
        EncryptedData encryptedPrivPart = cipherTextHandler.seal( subSessionKey, encReqPrivPart, KeyUsage.KRB_PRIV_ENC_PART_CHOSEN_KEY );

        // Make private message with private message part.
View Full Code Here

        {
            throw new KerberosException( ErrorType.KRB_AP_ERR_BAD_INTEGRITY, de );
        }

        // get the decoded EncKrbPrivPart
        EncKrbPrivPart encKrbPrivPart = ( ( EncKrbPrivPartContainer ) encKrbPrivPartContainer ).getEncKrbPrivPart();

        return encKrbPrivPart;
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.shared.kerberos.components.EncKrbPrivPart

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.