public byte [ ] createSecret ( PublicKeyCredentials pkcred , PrivateKey key , int length ) { _data = new AuthResponseData ( ) ; byte [ ] clientSecret = pkcred . getSecret ( key ) ; if ( clientSecret == null ) { _data . code = FAILED_TO_SECURE ; return null ; } byte [ ] secret = SecureUtil . createRandomKey ( length ) ; _data . code = StringUtil . hexlate ( SecureUtil . xorBytes ( secret , clientSecret ) ) ; return secret ; }
Encodes the server secret in the response data or sets the failed state .