public byte [ ] getEncodedValue ( ) { final String characterEncoding = this . chaiConfiguration . getSetting ( ChaiSetting . LDAP_CHARACTER_ENCODING ) ; final byte [ ] password = modifyPassword . getBytes ( Charset . forName ( characterEncoding ) ) ; final byte [ ] dn = modifyDn . getBytes ( Charset . forName ( characterEncoding ) ) ; // Sequence tag (1) + sequence length (1) + dn tag (1) + // dn length (1) + dn (variable) + password tag (1) + // password length (1) + password (variable) final int encodedLength = 6 + dn . length + password . length ; final byte [ ] encoded = new byte [ encodedLength ] ; int valueI = 0 ; // sequence start encoded [ valueI ++ ] = ( byte ) 0x30 ; // length of body encoded [ valueI ++ ] = ( byte ) ( 4 + dn . length + password . length ) ; encoded [ valueI ++ ] = LDAP_TAG_EXOP_X_MODIFY_PASSWD_ID ; encoded [ valueI ++ ] = ( byte ) dn . length ; System . arraycopy ( dn , 0 , encoded , valueI , dn . length ) ; valueI += dn . length ; encoded [ valueI ++ ] = LDAP_TAG_EXOP_X_MODIFY_PASSWD_NEW ; encoded [ valueI ++ ] = ( byte ) password . length ; System . arraycopy ( password , 0 , encoded , valueI , password . length ) ; valueI += password . length ; return encoded ; }
Get the BER encoded value for this operation .