/** * Decode the given string and creates a {@link Password} instance. * * @param cryptString the string representing the encoded format of the password * @return a {@link Password} instance created from the given string * @throws InvalidKeySpecException if the given password is not supported or could be decoded */ public static Password decode(String cryptString) throws InvalidKeySpecException { Assert.checkNotNullParam("cryptString", cryptString); return decode(cryptString.toCharArray()); }
private void parsePassword(final List<Credential> credentials, final XMLStreamReader streamReader) throws XMLStreamException, RealmUnavailableException { parseCredential(streamReader, (algorithm, format, text) -> { try { if (BASE64_FORMAT.equals(format)) { if (algorithm == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("algorithm", path, streamReader.getLocation().getLineNumber(), name); } byte[] passwordBytes = CodePointIterator.ofChars(text.toCharArray()).base64Decode().drain(); PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); PasswordSpec passwordSpec = BasicPasswordSpecEncoding.decode(passwordBytes); if (passwordSpec != null) { credentials.add(new PasswordCredential(passwordFactory.generatePassword(passwordSpec))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordAlgorithm(algorithm, path, streamReader.getLocation().getLineNumber(), name); } } else if (MCF_FORMAT.equals(format)) { credentials.add(new PasswordCredential(ModularCrypt.decode(text))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordFormat(format, path, streamReader.getLocation().getLineNumber(), name); } } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } }); }
pw = ModularCrypt.decode(c); } catch (InvalidKeySpecException e) { throw log.noAlgorithmForPassword(alias);
if (identified != null) { try { Password modularCryptPassword = ModularCrypt.decode(chars); if (log.isTraceEnabled()) { log.tracef("Key Mapper: Password credential created using Modular Crypt algorithm [%s]", identified);
/** * Decode the given string and creates a {@link Password} instance. * * @param cryptString the string representing the encoded format of the password * @return a {@link Password} instance created from the given string * @throws InvalidKeySpecException if the given password is not supported or could be decoded */ public static Password decode(String cryptString) throws InvalidKeySpecException { Assert.checkNotNullParam("cryptString", cryptString); return decode(cryptString.toCharArray()); }
/** * Decode the given string and creates a {@link Password} instance. * * @param cryptString the string representing the encoded format of the password * @return a {@link Password} instance created from the given string * @throws InvalidKeySpecException if the given password is not supported or could be decoded */ public static Password decode(String cryptString) throws InvalidKeySpecException { Assert.checkNotNullParam("cryptString", cryptString); return decode(cryptString.toCharArray()); }
/** * Decode the given string and creates a {@link Password} instance. * * @param cryptString the string representing the encoded format of the password * @return a {@link Password} instance created from the given string * @throws InvalidKeySpecException if the given password is not supported or could be decoded */ public static Password decode(String cryptString) throws InvalidKeySpecException { Assert.checkNotNullParam("cryptString", cryptString); return decode(cryptString.toCharArray()); }
private void parsePassword(final List<Credential> credentials, final XMLStreamReader streamReader) throws XMLStreamException, RealmUnavailableException { parseCredential(streamReader, (algorithm, format, text) -> { try { if (BASE64_FORMAT.equals(format)) { if (algorithm == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("algorithm", path, streamReader.getLocation().getLineNumber(), name); } byte[] passwordBytes = CodePointIterator.ofChars(text.toCharArray()).base64Decode().drain(); PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); PasswordSpec passwordSpec = BasicPasswordSpecEncoding.decode(passwordBytes); if (passwordSpec != null) { credentials.add(new PasswordCredential(passwordFactory.generatePassword(passwordSpec))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordAlgorithm(algorithm, path, streamReader.getLocation().getLineNumber(), name); } } else if (MCF_FORMAT.equals(format)) { credentials.add(new PasswordCredential(ModularCrypt.decode(text))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordFormat(format, path, streamReader.getLocation().getLineNumber(), name); } } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } }); }
private void parsePassword(final List<Credential> credentials, final XMLStreamReader streamReader) throws XMLStreamException, RealmUnavailableException { parseCredential(streamReader, (algorithm, format, text) -> { try { if (BASE64_FORMAT.equals(format)) { if (algorithm == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("algorithm", path, streamReader.getLocation().getLineNumber(), name); } byte[] passwordBytes = CodePointIterator.ofChars(text.toCharArray()).base64Decode().drain(); PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); PasswordSpec passwordSpec = BasicPasswordSpecEncoding.decode(passwordBytes); if (passwordSpec != null) { credentials.add(new PasswordCredential(passwordFactory.generatePassword(passwordSpec))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordAlgorithm(algorithm, path, streamReader.getLocation().getLineNumber(), name); } } else if (MCF_FORMAT.equals(format)) { credentials.add(new PasswordCredential(ModularCrypt.decode(text))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordFormat(format, path, streamReader.getLocation().getLineNumber(), name); } } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } }); }
private void parsePassword(final List<Credential> credentials, final XMLStreamReader streamReader) throws XMLStreamException, RealmUnavailableException { parseCredential(streamReader, (algorithm, format, text) -> { try { if (BASE64_FORMAT.equals(format)) { if (algorithm == null) { throw ElytronMessages.log.fileSystemRealmMissingAttribute("algorithm", path, streamReader.getLocation().getLineNumber(), name); } byte[] passwordBytes = CodePointIterator.ofChars(text.toCharArray()).base64Decode().drain(); PasswordFactory passwordFactory = PasswordFactory.getInstance(algorithm); PasswordSpec passwordSpec = BasicPasswordSpecEncoding.decode(passwordBytes); if (passwordSpec != null) { credentials.add(new PasswordCredential(passwordFactory.generatePassword(passwordSpec))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordAlgorithm(algorithm, path, streamReader.getLocation().getLineNumber(), name); } } else if (MCF_FORMAT.equals(format)) { credentials.add(new PasswordCredential(ModularCrypt.decode(text))); } else { throw ElytronMessages.log.fileSystemRealmInvalidPasswordFormat(format, path, streamReader.getLocation().getLineNumber(), name); } } catch (InvalidKeySpecException | NoSuchAlgorithmException e) { throw ElytronMessages.log.fileSystemRealmInvalidContent(path, streamReader.getLocation().getLineNumber(), name); } }); }
pw = ModularCrypt.decode(c); } catch (InvalidKeySpecException e) { throw log.noAlgorithmForPassword(alias);
pw = ModularCrypt.decode(c); } catch (InvalidKeySpecException e) { throw log.noAlgorithmForPassword(alias);
pw = ModularCrypt.decode(c); } catch (InvalidKeySpecException e) { throw log.noAlgorithmForPassword(alias);
if (identified != null) { try { Password modularCryptPassword = ModularCrypt.decode(chars); if (log.isTraceEnabled()) { log.tracef("Key Mapper: Password credential created using Modular Crypt algorithm [%s]", identified);
if (identified != null) { try { Password modularCryptPassword = ModularCrypt.decode(chars); if (log.isTraceEnabled()) { log.tracef("Key Mapper: Password credential created using Modular Crypt algorithm [%s]", identified);
if (identified != null) { try { Password modularCryptPassword = ModularCrypt.decode(chars); if (log.isTraceEnabled()) { log.tracef("Key Mapper: Password credential created using Modular Crypt algorithm [%s]", identified);