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

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



    @Test
    public void testPerfSlow() throws EncoderException
    {
        EncryptionKey ec = new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, new byte[]
            { 0x01, 0x02, 0x03 } );
        ByteBuffer buffer = ByteBuffer.allocate( ec.computeLength() );
        ec.encode( buffer );

        // long t0 = System.currentTimeMillis();

        for ( int i = 0; i < 10000000; i++ )
        {
            buffer.flip();
            ec.encode( buffer );
        }

        // long t1 = System.currentTimeMillis();

        //System.out.println( "Delta = " + ( t1 - t0 ) );
View Full Code Here



    @Test
    public void testPerfFast() throws EncoderException
    {
        EncryptionKey ec = new EncryptionKey( EncryptionType.AES128_CTS_HMAC_SHA1_96, new byte[]
            { 0x01, 0x02, 0x03 } );
        ByteBuffer encoded = ByteBuffer.allocate( ec.computeLength() );
        ec.encode( encoded );

        // long t0 = System.currentTimeMillis();

        //for ( int i = 0; i < 40000000; i++ )
        {
            encoded = ByteBuffer.allocate( ec.computeLength() );

            ec.encode( encoded );
        }

        // long t1 = System.currentTimeMillis();

        //System.out.println( "Delta2 = " + ( t1 - t0 ) );
View Full Code Here

        catch ( DecoderException de )
        {
            throw de;
        }

        EncryptionKey encryptionKey = encryptionKeyContainer.getEncryptionKey();

        if ( IS_DEBUG )
        {
            LOG.debug( "EncryptionKey : " + encryptionKey );
        }
View Full Code Here

            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( I18n.err( I18n.ERR_744_NULL_PDU_LENGTH ) );
        }

        EncryptionKey encKey = new EncryptionKey();
        encryptionKeyContainer.setEncryptionKey( encKey );

        if ( IS_DEBUG )
        {
            LOG.debug( "EncryptionKey created" );
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    protected void setIntegerValue( int value, EncryptionKeyContainer encryptionKeyContainer )
    {
        EncryptionKey encKey = encryptionKeyContainer.getEncryptionKey();

        EncryptionType encryptionType = EncryptionType.getTypeByValue( value );

        encKey.setKeyType( encryptionType );

        if ( IS_DEBUG )
        {
            LOG.debug( "keytype : {}", encryptionType );
        }
View Full Code Here

        long time = buffer.getInt();
        KerberosTime timeStamp = new KerberosTime( time * 1000 );

        byte keyVersion = buffer.get();

        EncryptionKey key = getKeyBlock( buffer );

        return new KeytabEntry( principalName, principalType, timeStamp, keyVersion, key );
    }
View Full Code Here

    {
        int type = buffer.getShort();
        byte[] keyblock = getCountedBytes( buffer );

        EncryptionType encryptionType = EncryptionType.getTypeByValue( type );
        EncryptionKey key = new EncryptionKey( encryptionType, keyblock );

        return key;
    }
View Full Code Here

    {
        PaData[] paData = new PaData[1];

        PaEncTsEnc encryptedTimeStamp = new PaEncTsEnc( timeStamp, 0 );

        EncryptionKey clientKey = getEncryptionKey( clientPrincipal, passPhrase );

        EncryptedData encryptedData = lockBox.seal( clientKey, encryptedTimeStamp,
            KeyUsage.AS_REQ_PA_ENC_TIMESTAMP_WITH_CKEY );

        ByteBuffer buffer = ByteBuffer.allocate( encryptedData.computeLength() );
View Full Code Here

    List<KeytabEntry> lstEntries = new ArrayList<KeytabEntry>();
    for (String principal : principalNames){
      // create 3 versions of the key to ensure methods don't return
      // duplicate principals
      for (int kvno=1; kvno <= 3; kvno++) {
        EncryptionKey key = new EncryptionKey(
            EncryptionType.UNKNOWN, "samplekey1".getBytes(), kvno);
        KeytabEntry keytabEntry = new KeytabEntry(
            principal, 1 , new KerberosTime(), (byte) 1, key);
        lstEntries.add(keytabEntry);     
      }
View Full Code Here

      createPrincipal(principal, generatedPassword);
      principal = principal + "@" + getRealm();
      KerberosTime timestamp = new KerberosTime();
      for (Map.Entry<EncryptionType, EncryptionKey> entry : KerberosKeyFactory
              .getKerberosKeys(principal, generatedPassword).entrySet()) {
        EncryptionKey ekey = entry.getValue();
        byte keyVersion = (byte) ekey.getKeyVersion();
        entries.add(new KeytabEntry(principal, 1L, timestamp, keyVersion,
                ekey));
      }
    }
    keytab.setEntries(entries);
View Full Code Here

TOP

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

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.