@Nonnull public static String generateNewTokenID (@Nonnegative final int nBytes) { final byte [] aID = new byte [nBytes]; RandomHelper.getRandom ().nextBytes (aID); return StringHelper.getHexEncoded (aID); } }
@Deprecated @UsedViaReflection public ServerLogSessionKey () { final byte [] aKey = new byte [8]; VerySecureRandom.getInstance ().nextBytes (aKey); m_sGeneratedKey = StringHelper.getHexEncoded (aKey); }
/** * Constructor to create a new password salt with the provided byte count. * * @param nSaltBytes * The number of salt bytes to use. Must be > 0. */ public PasswordSalt (@Nonnegative final int nSaltBytes) { ValueEnforcer.isGT0 (nSaltBytes, "SaltBytes"); m_aBytes = new byte [nSaltBytes]; RandomHelper.getRandom ().nextBytes (m_aBytes); m_sSalt = StringHelper.getHexEncoded (m_aBytes); }
private PasswordSalt (@Nonnull @Nonempty final byte [] aBytes) { ValueEnforcer.notEmpty (aBytes, "Bytes"); m_aBytes = aBytes; m_sSalt = StringHelper.getHexEncoded (aBytes); }
private String _getMD5sum () { m_aPW.flush (); final byte [] digest = m_dos.getMessageDigest ().digest (); return StringHelper.getHexEncoded (digest); }
@Nonnull public String createPasswordHash (@Nonnull final IPasswordSalt aSalt, @Nonnull final String sPlainTextPassword) { ValueEnforcer.notNull (aSalt, "Salt"); ValueEnforcer.notNull (sPlainTextPassword, "PlainTextPassword"); final byte [] aDigest = pbkdf2 (sPlainTextPassword.toCharArray (), aSalt.getSaltBytes (), m_nIterations, m_nHashBytes); return StringHelper.getHexEncoded (aDigest); } }
@Nonnull @Nonempty public String createNewNonce () { return m_aRWLock.writeLocked ( () -> { String sNonce; int nCount = 0; do { // Ensure a unique nonce final byte [] aNonce = new byte [NONCE_BYTES]; VerySecureRandom.getInstance ().nextBytes (aNonce); sNonce = StringHelper.getHexEncoded (aNonce); // Avoid endless loop if (++nCount > 100) throw new IllegalStateException ("Failed to create a unique nonce after " + nCount + " tries!"); } while (!m_aNonces.add (sNonce)); return sNonce; }); }
final String calculatedDigest = StringHelper.getHexEncoded (digestStream.getMessageDigest ().digest ());
m_sContentHash = StringHelper.getHexEncoded (aDigestBytes);
@Override public String toString () { return ToStringGenerator.getDerived (super.toString ()) .append ("EventHandler", m_aEventHandler) .append ("NamespaceContext", m_aNSContext) .append ("FormattedOutput", m_bFormattedOutput) .append ("Charset", m_aCharset) .append ("IndentString", StringHelper.getHexEncoded (m_sIndentString, StandardCharsets.ISO_8859_1)) .append ("SchemaLocation", m_sSchemaLocation) .append ("NoNamespaceSchemaLocation", m_sNoNamespaceSchemaLocation) .getToString (); } }
@Override public String toString () { if (m_sIndentationStringToString == null) m_sIndentationStringToString = StringHelper.getHexEncoded (m_sIndentationString.getBytes (StandardCharsets.ISO_8859_1)); return new ToStringGenerator (this).append ("xmlVersion", m_eXMLVersion) .append ("serializeXMLDecl", m_eSerializeXMLDecl) .append ("serializeDocType", m_eSerializeDocType) .append ("serializeComments", m_eSerializeComments) .append ("indent", m_eIndent) .append ("indentDeterminator", m_aIndentDeterminator) .append ("incorrectCharHandling", m_eIncorrectCharacterHandling) .append ("charset", m_aCharset) .append ("namespaceContext", m_aNamespaceContext) .append ("doubleQuotesForAttrs", m_bUseDoubleQuotesForAttributes) .append ("bracketModeDeterminator", m_aBracketModeDeterminator) .append ("spaceOnSelfClosedElement", m_bSpaceOnSelfClosedElement) .append ("newlineMode", m_eNewLineMode) .append ("indentationString", m_sIndentationStringToString) .append ("emitNamespaces", m_bEmitNamespaces) .append ("putNamespaceContextPrefixesInRoot", m_bPutNamespaceContextPrefixesInRoot) .append ("writeCDATAAsText", m_bWriteCDATAAsText) .append ("orderAttributesAndNamespaces", m_bOrderAttributesAndNamespaces) .getToString (); }
@Override public String toString () { return new ToStringGenerator (this).append ("Type", m_aType) .append ("XSDs", m_aXSDs) .append ("JAXBElementWrapper", m_aJAXBElementWrapper) .append ("VEHFactory", m_aVEHFactory) .append ("ReadSecure", m_bReadSecure) .append ("FormattedOutput", m_bFormattedOutput) .append ("NSContext", m_aNSContext) .append ("Charset", m_aCharset) .append ("IndentString", StringHelper.getHexEncoded (m_sIndentString, StandardCharsets.ISO_8859_1)) .append ("SchemaLocation", m_sSchemaLocation) .append ("NoNamespaceSchemaLocation", m_sNoNamespaceSchemaLocation) .append ("UseContextCache", m_bUseContextCache) .append ("ClassLoader", m_aClassLoader) .append ("ReadExceptionHandlers", m_aReadExceptionCallbacks) .append ("WriteExceptionHandlers", m_aWriteExceptionCallbacks) .getToString (); }
aRow.addCell (aMAC == null ? "" : StringHelper.getHexEncoded (aMAC));
aRow.addCell (aMAC == null ? "" : StringHelper.getHexEncoded (aMAC));
aRow.addCell (aMAC == null ? "" : StringHelper.getHexEncoded (aMAC));