mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

david_page
09.33.2007 2817b2d327886f6563859528f540a5a377dc36cf
issue 466 (partial)
CryptoManager
more i18n cleanup
2 files modified
89 ■■■■ changed files
opends/src/messages/messages/core.properties 23 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/CryptoManager.java 66 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/core.properties
@@ -1722,9 +1722,20 @@
 cannot initialize Cipher:  %s
SEVERE_ERR_CRYPTOMGR_GET_CIPHER_STREAM_PROLOGUE_WRITE_ERROR_682=CryptoManager \
 failed to write the stream prologue:  %s
SEVERE_ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_KEY_IDENTIFIER_683=CryptoManager \
 failed to read the symmetric key identifier from the data prologue:  %s
SEVERE_ERR_CRYPTOMGR_DECRYPT_UNKNOWN_KEY_IDENTIFIER_684=CryptoManager does not \
 recognize the symmetric key identifier in the data prologue
SEVERE_ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_IV_685=CryptoManager failed to \
 read the initialization vector from the data prologue:  %s
MILD_ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_KEY_IDENTIFIER_683=CryptoManager \
 failed to decrypt the supplied data because it could not read the symmetric \
 key identifier in the data prologue
MILD_ERR_CRYPTOMGR_DECRYPT_UNKNOWN_KEY_IDENTIFIER_684=CryptoManager failed to \
 decrypt the supplied data because the symmetric key identifier in the data \
 prologue does not match any known key entries
MILD_ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_IV_685=CryptoManager failed to \
 decrypt the supplied data because it could not read the cipher initialization \
 vector in the data prologue
MILD_ERR_CRYPTOMGR_DECRYPT_CIPHER_INPUT_STREAM_ERROR_686=CryptoManager failed \
 to decrypt the supplied data because there was an error reading from the \
 input stream:  %s
SEVERE_ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_TO_DECODE_687=CryptoManager \
 failed to import the symmetric key entry "%s" because there is no symmetric \
 key attribute value that can be decoded by this instance"
SEVERE_ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_OTHER_688=CryptoManager failed \
 to import the symmetric key entry "%s":  %s
opends/src/server/org/opends/server/types/CryptoManager.java
@@ -1474,8 +1474,8 @@
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
      throw new CryptoManagerException(
              ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_KEY_IDENTIFIER.get(
                      getExceptionMessage(ex)), ex);
           ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_KEY_IDENTIFIER.get(),
              ex);
    }
    CipherKeyEntry keyEntry = CipherKeyEntry.getKeyEntry(this, keyID);
@@ -1497,8 +1497,7 @@
          TRACER.debugCaught(DebugLogLevel.ERROR, ex);
        }
        throw new CryptoManagerException(
               ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_IV.get(
                       getExceptionMessage(ex)), ex);
               ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_IV.get(), ex);
      }
    }
@@ -1534,35 +1533,27 @@
      final byte[] keyID = new byte[KeyEntryID.getByteValueLength()];
      if (keyID.length != inputStream.read(keyID)){
        throw new CryptoManagerException(
                // TODO: i18n
                Message.raw("Stream underflow when reading key" +
                        " identifier from data prologue."));
           ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_KEY_IDENTIFIER.get());
      }
      keyEntry = CipherKeyEntry.getKeyEntry(this,
              new KeyEntryID(keyID));
      if (null == keyEntry) {
        throw new CryptoManagerException(
                // TODO: i18N
             Message.raw("Invalid key identifier in data prologue."));
                ERR_CRYPTOMGR_DECRYPT_UNKNOWN_KEY_IDENTIFIER.get());
      }
      if (0 < keyEntry.getIVLengthBits()) {
        iv = new byte[keyEntry.getIVLengthBits() / Byte.SIZE];
        if (iv.length != inputStream.read(iv)) {
          throw new CryptoManagerException(
                  // TODO: i18n
                  Message.raw("Stream underflow when reading" +
                      " initialization vector from data prologue."));
                  ERR_CRYPTOMGR_DECRYPT_FAILED_TO_READ_IV.get());
        }
      }
    }
    catch (IOException ex) {
      throw new CryptoManagerException(
              // TODO: i18n
              Message.raw("Exception when reading CryptoManager"
                      + " prologue:  "
                      + getExceptionMessage(ex).toString()), ex);
             ERR_CRYPTOMGR_DECRYPT_CIPHER_INPUT_STREAM_ERROR.get(
                     getExceptionMessage(ex)), ex);
    }
    return new CipherInputStream(inputStream,
@@ -1839,11 +1830,9 @@
      if (secretKey == null)
      {
        // TODO: i18n
        Message message = Message.raw("Key entry %s contains no " +
                "symmetric key value that can be decoded " +
                "by this server", entry.getDN());
        throw new CryptoManagerException(message);
        throw new CryptoManagerException(
                ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_TO_DECODE.get(
                        entry.getDN().toString()));
      }
      boolean isCompromised = compromisedTime != null;
@@ -1855,16 +1844,14 @@
                                          isCompromised);
    }
    catch (DirectoryException e)
    catch (DirectoryException ex)
    {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
      // TODO: i18n
      Message message =
           Message.raw("Error decoding cipher key entry %s: %s",
                       entry.getDN(), e.getMessage());
      throw new CryptoManagerException(message, e);
      throw new CryptoManagerException(
              ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_OTHER.get(
                      entry.getDN().toString(), ex.getMessage()), ex);
    }
  }
@@ -1919,13 +1906,9 @@
      if (secretKey == null)
      {
        // TODO: i18n
        Message message =
             Message.raw("Key entry %s contains no " +
                  "symmetric key value that can be decoded " +
                  "by this server",
                         entry.getDN());
        throw new CryptoManagerException(message);
        throw new CryptoManagerException(
                ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_TO_DECODE.get(
                        entry.getDN().toString()));
      }
      boolean isCompromised = compromisedTime != null;
@@ -1935,15 +1918,14 @@
                                    isCompromised);
    }
    catch (DirectoryException e)
    catch (DirectoryException ex)
    {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
        TRACER.debugCaught(DebugLogLevel.ERROR, ex);
      }
      Message message =
           Message.raw("Error decoding mac key entry %s: %s",
                       entry.getDN(), e.getMessage());
      throw new CryptoManagerException(message, e);
      throw new CryptoManagerException(
              ERR_CRYPTOMGR_IMPORT_KEY_ENTRY_FAILED_OTHER.get(
                      entry.getDN().toString(), ex.getMessage()), ex);
    }
  }