| | |
| | | extends PasswordStorageScheme<CryptPasswordStorageSchemeCfg> |
| | | implements ConfigurationChangeListener<CryptPasswordStorageSchemeCfg> |
| | | { |
| | | |
| | | /** |
| | | * The fully-qualified name of this class for debugging purposes. |
| | | */ |
| | | /** The fully-qualified name of this class for debugging purposes. */ |
| | | private static final String CLASS_NAME = |
| | | "org.opends.server.extensions.CryptPasswordStorageScheme"; |
| | | |
| | | /** |
| | | * The current configuration for the CryptPasswordStorageScheme. |
| | | */ |
| | | /** The current configuration for the CryptPasswordStorageScheme. */ |
| | | private CryptPasswordStorageSchemeCfg currentConfig; |
| | | |
| | | /** |
| | |
| | | private final Object saltLock = new Object(); |
| | | private final Crypt crypt = new Crypt(); |
| | | |
| | | |
| | | /** |
| | | * Creates a new instance of this password storage scheme. Note that no |
| | | * initialization should be performed here, as all initialization should be |
| | |
| | | super(); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializePasswordStorageScheme( |
| | | CryptPasswordStorageSchemeCfg configuration) |
| | | throws ConfigException, InitializationException { |
| | | |
| | | configuration.addCryptChangeListener(this); |
| | | |
| | | currentConfig = configuration; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String getStorageSchemeName() |
| | | { |
| | | return STORAGE_SCHEME_NAME_CRYPT; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Encrypt plaintext password with the Unix Crypt algorithm. |
| | | */ |
| | | /** Encrypt plaintext password with the Unix Crypt algorithm. */ |
| | | private ByteString unixCryptEncodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | | { |
| | |
| | | return ByteString.valueOfUtf8(output); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return bytes; |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodePasswordWithScheme(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | return ByteString.valueOfUtf8(buffer); |
| | | } |
| | | |
| | | /** |
| | | * Matches passwords encrypted with the Unix Crypt algorithm. |
| | | */ |
| | | /** Matches passwords encrypted with the Unix Crypt algorithm. */ |
| | | private boolean unixCryptPasswordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean passwordMatches(ByteSequence plaintextPassword, |
| | | ByteSequence storedPassword) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean supportsAuthPasswordSyntax() |
| | | { |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString encodeAuthPassword(ByteSequence plaintext) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean authPasswordMatches(ByteSequence plaintextPassword, |
| | | String authInfo, String authValue) |
| | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isReversible() |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getPlaintextValue(ByteSequence storedPassword) |
| | | throws DirectoryException |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ByteString getAuthPasswordPlaintextValue(String authInfo, |
| | | String authValue) |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isStorageSchemeSecure() |
| | | { |
| | |
| | | // category, but it's certainly a lot more vulnerable to lookup tables |
| | | // than most other algorithms. I'd say we can keep it this way for now, |
| | | // but it might be something to reconsider later. |
| | | // |
| | | // Currently, this method is unused. However, the intended purpose is |
| | | // eventually for use in issue #321, where we could do things like prevent |
| | | // even authorized users from seeing the password value over an insecure |
| | |
| | | return false; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAcceptable( |
| | | PasswordStorageSchemeCfg configuration, |
| | |
| | | return isConfigurationChangeAcceptable(config, unacceptableReasons); |
| | | } |
| | | |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | CryptPasswordStorageSchemeCfg configuration, |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | CryptPasswordStorageSchemeCfg configuration) |