protected SecretKey generateContentKey()

in sdk1/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/encryption/materials/WrappedRawMaterials.java [182:200]


  protected SecretKey generateContentKey(final String algorithm) throws NoSuchAlgorithmException {
    String[] pieces = algorithm.split("/", 2);
    KeyGenerator kg = KeyGenerator.getInstance(pieces[0]);
    int keyLen = 0;
    if (pieces.length == 2) {
      try {
        keyLen = Integer.parseInt(pieces[1]);
      } catch (NumberFormatException ex) {
        keyLen = 0;
      }
    }

    if (keyLen > 0) {
      kg.init(keyLen, Utils.getRng());
    } else {
      kg.init(Utils.getRng());
    }
    return kg.generateKey();
  }