protected String formatCredentials ( final ChallengeResponse challenge ) throws GeneralSecurityException { // Data buffer final StringBuffer sb = new StringBuffer ( ) ; // Indexes buffer final StringBuffer isb = new StringBuffer ( ) ; final String timeIssued = Long . toString ( System . currentTimeMillis ( ) ) ; int i = timeIssued . length ( ) ; sb . append ( timeIssued ) ; isb . append ( i ) ; final String identifier = challenge . getIdentifier ( ) ; sb . append ( ' ' ) ; sb . append ( identifier ) ; i += identifier . length ( ) + 1 ; isb . append ( ' ' ) . append ( i ) ; sb . append ( ' ' ) ; sb . append ( challenge . getSecret ( ) ) ; // Store indexes at the end of the string sb . append ( ' ' ) ; sb . append ( isb ) ; return Base64 . encode ( CryptoUtils . encrypt ( this . getEncryptAlgorithm ( ) , this . getEncryptSecretKey ( ) , sb . toString ( ) ) , false ) ; }
Formats the raws credentials to store in the cookie .