* @throws LdapException If we had an error while adding a key in the attribute
*/
private Attribute getKeyAttribute( Map<EncryptionType, EncryptionKey> keys )
throws LdapException
{
Attribute keyAttribute = new DefaultAttribute( KRB5_KEY_AT );
for ( EncryptionKey encryptionKey : keys.values() )
{
try
{
ByteBuffer buffer = ByteBuffer.allocate( encryptionKey.computeLength() );
encryptionKey.encode( buffer );
keyAttribute.add( buffer.array() );
}
catch ( EncoderException ioe )
{
LOG.error( I18n.err( I18n.ERR_122 ), ioe );
LOG_KRB.error( I18n.err( I18n.ERR_122 ), ioe );